繁体   English   中英

Flutter 视频播放进度

[英]Flutter video_player progress

我有一个 flutter 应用程序,其中安装了video_playerchewie包。 我可以毫无问题地播放任何视频,但我需要跟踪视频进度。 我尝试使用侦听器,但它无法按我想要的方式工作。

    _chewieController.addListener(() {
      int seconds = _chewieController.videoPlayerController.value.position.inSeconds;
      if (seconds == 60){ // just an example
        // do some action
      }
    });

视频进度永远不会调用侦听器。 我应该怎么做才能让它发挥作用?

我不知道chewie(看起来很酷)。 我认为您应该将侦听器添加到 VideoController 实例(而不是咀嚼控制器)。

VideoPlayer package 给我们VideoProgressIndicator(controller, allowScrubbing: true)小部件,这样你就可以将你的 VideoPlayer 包装在 Stack 中,并将 VideoProgressIndicator 作为他们的孩子

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM