How to detect new position of video in Flutter?

Issue

So I am using the video_player package in my Flutter project and have made use of VideoProgressIndicator and it works exactly as intended:

Widget progBar(BuildContext context) {
  return VideoProgressIndicator(
    _controller,
    allowScrubbing: true, // user can touch/drag bar to change position of video.
    colors: VideoProgressColors(playedColor: Colors.red, bufferedColor: Colors.white),
    padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 9),
  );
}

The issue:

I have the timestamp(s) of the video as part of the player and when the user uses the VideoProgressIndicator to change the position of the video, I don’t have the new position of the video so that I can update the timestamp(s).

My question:

How can I get the new position of the video when the VideoProgressIndicator changes it?

Thank You!

Solution

Ok so I figured out my solution to be simply to create a custom progress bar that manipulates a timer.

Answered By – camelCaseIsGoodPractice

Answer Checked By – Katrina (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *