flutter_vlc_player icon indicating copy to clipboard operation
flutter_vlc_player copied to clipboard

isBuffering is not working

Open ljmatan opened this issue 4 years ago • 9 comments

I try to display a circular progress indicator whenever the player is buffering.

If I use _videoPlayerController.value.isBuffering then it returns true even if the video is playing. If I use _videoPlayerController.value.isBuffering && !_videoPlayerController.value.isPlaying then it returns false even if the video is buffering and not, in fact, playing.

ljmatan avatar Mar 02 '21 20:03 ljmatan

in vlc library the buffering event is called all the times even when the video is playing and seek position is changing, so i guess you cannot use that option for this behavior. In the PR #193, we set the isBuffering false in the playing event.

alr2413 avatar Mar 04 '21 18:03 alr2413

So @ljmatan how did you solve this problem eventually?

hongfeiyang avatar Mar 11 '21 04:03 hongfeiyang

@hongfeiyang you could probably set a timer to run periodically every 500ms (for example) and cancel and set it via video player controller listener. If timer successfully ran show buffering indicator.

ljmatan avatar Mar 11 '21 04:03 ljmatan

@ljmatan Could you elaborate a bit more? For example what type of event or value do you propose one should monitor to know that a video is actually buffering (like the normal buffering behaviour one should expect to see in other video players)

From what I have tested this VLC player seems to set its states to isPlaying while buffering for the first few chunk of a video, if the first few chunks arrive very late, it will just show a blank black screen for a long period of time and got my app rejected by the App Store

hongfeiyang avatar Mar 11 '21 04:03 hongfeiyang

Listen to duration, if duration had not been updated for more than n ms show buffering indicator.

ljmatan avatar Mar 11 '21 04:03 ljmatan

flutter: VlcPlayerValue(duration: 0:00:31.433000, size: Size(0.0, 0.0), position: 0:00:00.000000, playingState: PlayingState.playing, isInitialized true, isPlaying: true, isLooping: false, isBuffering: false, isEnded: false, bufferPercent: 100.0, volume: 100, playbackSpeed: 1.0, audioTracksCount: 0, activeAudioTrack: -1, spuTracksCount: 0, activeSpuTrack: -1, errorDescription: null)
flutter: VlcPlayerValue(duration: 0:00:31.433000, size: Size(720.0, 404.0), position: 0:00:00.000000, playingState: PlayingState.playing, isInitialized true, isPlaying: true, isLooping: false, isBuffering: false, isEnded: false, bufferPercent: 100.0, volume: 100, playbackSpeed: 1.0, audioTracksCount: 0, activeAudioTrack: -1, spuTracksCount: 0, activeSpuTrack: -1, errorDescription: null)
flutter: VlcPlayerValue(duration: 0:00:31.433000, size: Size(720.0, 404.0), position: 0:00:00.236000, playingState: PlayingState.playing, isInitialized true, isPlaying: true, isLooping: false, isBuffering: false, isEnded: false, bufferPercent: 100.0, volume: 100, playbackSpeed: 1.0, audioTracksCount: 0, activeAudioTrack: -1, spuTracksCount: 0, activeSpuTrack: -1, errorDescription: null)

I think I would listen to the position change instead, since the duration is know already but it still took a long time to load the first frame in a bad network. I think a good solution would be for VLC player to load the first frame initially to display it there

hongfeiyang avatar Mar 11 '21 04:03 hongfeiyang

i'll check LibVLC to see if the buffering state can be separated from other events or not.

alr2413 avatar Mar 11 '21 18:03 alr2413

Any update for this?

TailsxKyuubi avatar Aug 23 '21 13:08 TailsxKyuubi

Any update for this?

khjdot156 avatar Oct 07 '21 07:10 khjdot156