dart 如何播放两个视频并排模式同时在Flutter

i1icjdpr  于 2023-04-27  发布在  Flutter
关注(0)|答案(1)|浏览(178)

我需要同时播放两个视频并排进行比较.我能够得到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),
                ),
             ),
          ),
       ],
    ),
)
fkaflof6

fkaflof61#

This issue report建议在传递给ChewieControllerVideoPlayerController上将mixWithOthers设置为true

videoController = VideoPlayerController.network(
  videoUrl,
  videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true),
);

相关问题