怎么能让视频播放器持续在 Flutter 呢?

dhxwm5r4  于 2022-11-25  发布在  Flutter
关注(0)|答案(2)|浏览(162)

如何获得视频持续时间而不

https://pub.dev/packages/video_player

包或基地这个球员。有没有其他的方法?
视频播放器持续时间

brgchamk

brgchamk1#

你也可以用ffmpeg包进行同样的操作,只是做:

class ClassName {
      final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();
        ...
      void someFunction() {
        _flutterFFmpeg
            .getMediaInformation("<file path or uri>")
            .then((info) => print(info));
      }
    }
j2cgzkjk

j2cgzkjk2#

您可以使用视频控制器:

VideoPlayerController _controller = VideoPlayerController.network('https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4')
      ..initialize().then((_) {
        // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
      });

 Duration durationOfVideo = _controller.value.duration;

相关问题