'How to track video watch time?

Users watch video content so I need to know how many seconds they'll be watching that content. Example content is 1 minute long and "A" user-watched only 10 seconds etc...

This is how I implemented video player:

  @override
  void initState() {
    if (Platform.isIOS || Platform.isAndroid) {
      videoCtrl = VideoPlayerController.network(widget.videoPath);
      videoCtrl.initialize().then((value) {
        videoCtrl.setVolume(widget.isPlay ? 1 : 0);
        videoCtrl.addListener(() {
          // TODO
        });
        setState(() {});
        videoCtrl.play();
      });
      videoCtrl.setLooping(false);
    }
    super.initState();
  }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source