我需要同时并排播放两个视频进行比较。我能够完成UI。但是一次只能播放一个视频。另一个视频播放时,我暂停另一个视频。我需要两个同时播放两个视频。下面是我当前的代码:
SizedBox(
width: deviceWidth,
height: deviceHeight,
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
width: deviceWidth / 2,
child: _controller1 != null
? Chewie(
controller: ChewieController(
videoPlayerController: _controller1!,
autoPlay: true,
looping: true,
),
)
: const Center(
child: Text(
'No video selected',
style: TextStyle(color: Colors.white),
),
),
),
SizedBox(
width: deviceWidth / 2,
child: _controller2 != null
? Chewie(
controller: ChewieController(
videoPlayerController: _controller2,
autoPlay: true,
looping: true,
),
)
: const Center(
child: Text(
'No video selected',
style: TextStyle(color: Colors.white),
),
),
),
],
),
)
此问题报告建议在传递给ChewieController
的VideoPlayerController
上设置mixWithOthers
为true
。
videoController = VideoPlayerController.network(
videoUrl,
videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true),
);