void _initVideoPlayer() async {
_videoPlayerController = VideoPlayerController.network(
'https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4');
/// Initialize the video player
await videoPlayerController.initialize();
/// The rest of your code
final chewieController = ChewieController(
videoPlayerController: videoPlayerController,
autoPlay: true,
looping: true,
);
final playerWidget = Chewie(
controller: chewieController,
);
}
1条答案
按热度按时间0yg35tkg1#
尝试以这种方式初始化视频播放器:
通过创建一个异步方法