flutter - 屏幕一侧的绿色 strip 有 video_player 抖动

标签 flutter sidebar android-tv flutter-video-player

enter image description here video_player flutter 中的某些视频中有一些绿色侧边栏。它在移动设备上运行良好,但在 Android 电视上播放时会出现绿色条。

我的代码示例

class VideoWidget extends StatelessWidget {
  const VideoWidget({Key? key, required this.controller}) : super(key: key);
  final VideoPlayerController controller;

  @override
  Widget build(BuildContext context) {
    return Container(alignment: Alignment.topCenter, child: buildVideo());
  }

  Widget buildVideo() => Stack(
        fit: StackFit.expand,
        children: <Widget>[
          buildVideoPlayer(),
        ],
      );

  Widget buildVideoPlayer() => buildFullScreen(
        child: AspectRatio(
          aspectRatio: controller.value.aspectRatio,
          child: VideoPlayer(controller),
        ),
      );

  Widget buildFullScreen({
    required Widget child,
  }) {
    final size = controller.value.size;
    final width = size.width;
    final height = size.height;
  
    return FittedBox(
      fit: BoxFit.fill,
      child: SizedBox(width: width,height: height, child: child),
    );
  }
} 

flutter 版本:3.0.2, 视频播放器版本:2.4.5, 安卓版本:11.1, Android盒子型号:MBOX

最佳答案

这是video_player的一个错误:https://github.com/flutter/flutter/issues/34642#issuecomment-640976190

在等待bug修复期间,您可以尝试使用其他方法。例如,此包使用 native 播放器:https://pub.dev/packages/native_video_view

关于flutter - 屏幕一侧的绿色 strip 有 video_player 抖动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73555775/

相关文章:

android - 如何在 flutter 中处理后退时的切换页面逻辑

JSON 只解析为动态类型,而不是 Map

flutter_screenutil - 模拟器与真实手机上的文本大小不同

android - VerticalGridFragment 无限滚动

javascript - 使用js.context.callMethod()调用方法时如何接收数据返回flutter?

javascript - CSS JS 固定位置侧边栏

html - 侧边栏菜单没有延伸到页面底部(CSS 让我抓狂……)

vector - MediaWiki:Vector Collapsible Sidebar,一级标题问题

android - 在 Android 上检测 4K UHD 屏幕

Android TV - Leanback 库如何向 VideoSupportFragmentGlueHost 添加更多按钮