I have a flutter app with video_player and chewie packages installed. I'm able to play any video without problem, but I need to keep track of the video progress. I tried using a listener, but it doesn't work the way I want it.
_chewieController.addListener(() {
int seconds = _chewieController.videoPlayerController.value.position.inSeconds;
if (seconds == 60){ // just an example
// do some action
}
});
The listener is never called by the video progress. What should I do to make it work?
I didn't know about chewie (it looks cool). I think you should add the listener to the VideoController instance (and not to the chewie controller).
VideoPlayer package give us VideoProgressIndicator(controller, allowScrubbing: true)
widget so you can wrap your VideoPlayer in Stack and give VideoProgressIndicator as their child
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.