Video constructor
const
Video({
- Key? key,
- required VideoController controller,
- double? width,
- double? height,
- BoxFit fit = BoxFit.contain,
- Color fill = const Color(0xFF000000),
- Alignment alignment = Alignment.center,
- double? aspectRatio,
- FilterQuality filterQuality = FilterQuality.low,
- VideoControlsBuilder? controls = media_kit_video_controls.AdaptiveVideoControls,
- bool wakelock = true,
- bool pauseUponEnteringBackgroundMode = true,
- SubtitleViewConfiguration subtitleViewConfiguration = const SubtitleViewConfiguration(),
- Future<
void> onEnterFullscreen() = defaultEnterNativeFullscreen, - 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.subtitleViewConfiguration = const SubtitleViewConfiguration(),
this.onEnterFullscreen = defaultEnterNativeFullscreen,
this.onExitFullscreen = defaultExitNativeFullscreen,
}) : super(key: key);