Flutter video_player 进度
Flutter video_player progress
我有一个安装了 video_player and chewie 包的 flutter 应用程序。我可以毫无问题地播放任何视频,但我需要跟踪视频进度。我尝试使用侦听器,但它无法按照我想要的方式工作。
_chewieController.addListener(() {
int seconds = _chewieController.videoPlayerController.value.position.inSeconds;
if (seconds == 60){ // just an example
// do some action
}
});
视频进度永远不会调用侦听器。
我应该怎么做才能让它发挥作用?
我不知道 chewie(它看起来很酷)。
我认为您应该将侦听器添加到 VideoController 实例(而不是 chewie 控制器)。
我有一个安装了 video_player and chewie 包的 flutter 应用程序。我可以毫无问题地播放任何视频,但我需要跟踪视频进度。我尝试使用侦听器,但它无法按照我想要的方式工作。
_chewieController.addListener(() {
int seconds = _chewieController.videoPlayerController.value.position.inSeconds;
if (seconds == 60){ // just an example
// do some action
}
});
视频进度永远不会调用侦听器。 我应该怎么做才能让它发挥作用?
我不知道 chewie(它看起来很酷)。 我认为您应该将侦听器添加到 VideoController 实例(而不是 chewie 控制器)。