Search code examples
fluttervideoprogress

Flutter video_player progress


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?


Solution

  • 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).