Video constructor

const Video({
  1. Key? key,
  2. required VideoController controller,
  3. double? width,
  4. double? height,
  5. BoxFit fit = BoxFit.contain,
  6. Color fill = const Color(0xFF000000),
  7. Alignment alignment = Alignment.center,
  8. double? aspectRatio,
  9. FilterQuality filterQuality = FilterQuality.low,
  10. VideoControlsBuilder? controls = media_kit_video_controls.AdaptiveVideoControls,
  11. bool wakelock = true,
  12. bool pauseUponEnteringBackgroundMode = true,
  13. bool resumeUponEnteringForegroundMode = false,
  14. SubtitleViewConfiguration subtitleViewConfiguration = const SubtitleViewConfiguration(),
  15. Future<void> onEnterFullscreen() = defaultEnterNativeFullscreen,
  16. Future<void> onExitFullscreen() = defaultExitNativeFullscreen,
})

Video

Video widget is used to display video output.

Use VideoController to initialize & handle the video rendering.

Example:

class MyScreen extends StatefulWidget {
  const MyScreen({Key? key}) : super(key: key);
  @override
  State<MyScreen> createState() => MyScreenState();
}

class MyScreenState extends State<MyScreen> {
  late final player = Player();
  late final controller = VideoController(player);

  @override
  void initState() {
    super.initState();
    player.open(Media('https://user-images.githubusercontent.com/28951144/229373695-22f88f13-d18f-4288-9bf1-c3e078d83722.mp4'));
  }

  @override
  void dispose() {
    player.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Video(
        controller: controller,
      ),
    );
  }
}

Implementation

const Video({
  Key? key,
  required this.controller,
  this.width,
  this.height,
  this.fit = BoxFit.contain,
  this.fill = const Color(0xFF000000),
  this.alignment = Alignment.center,
  this.aspectRatio,
  this.filterQuality = FilterQuality.low,
  this.controls = media_kit_video_controls.AdaptiveVideoControls,
  this.wakelock = true,
  this.pauseUponEnteringBackgroundMode = true,
  this.resumeUponEnteringForegroundMode = false,
  this.subtitleViewConfiguration = const SubtitleViewConfiguration(),
  this.onEnterFullscreen = defaultEnterNativeFullscreen,
  this.onExitFullscreen = defaultExitNativeFullscreen,
}) : super(key: key);