2

enter image description hereThere is some green sidebar in some of the video in video_player flutter. It works fine in mobile but green bar appears when played on android tv.

My code sample

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 version: 3.0.2 , Video Player version:2.4.5 , Android version: 11.1 , Android box model: MBOX

1 Answers1

2

This is a bug of video_player: https://github.com/flutter/flutter/issues/34642#issuecomment-640976190

While waiting for the bug to be fixed, you can try using other methods. For example, this package uses the native player instead: https://pub.dev/packages/native_video_view