NativeVideo constructor
NativeVideo({
- Key? key,
- required Player player,
- double? width,
- double? height,
- BoxFit fit = BoxFit.contain,
- AlignmentGeometry alignment = Alignment.center,
- double scale = 1.0,
- bool showControls = true,
- Color? progressBarActiveColor,
- Color? progressBarInactiveColor = Colors.white24,
- Color? progressBarThumbColor,
- Color? progressBarThumbGlowColor = const Color.fromRGBO(0, 161, 214, .2),
- Color? volumeActiveColor,
- Color? volumeInactiveColor = Colors.grey,
- Color volumeBackgroundColor = const Color(0xff424242),
- Color? volumeThumbColor,
- double? progressBarThumbRadius = 10.0,
- double? progressBarThumbGlowRadius = 15.0,
- bool showTimeLeft = false,
- TextStyle progressBarTextStyle = const TextStyle(),
- FilterQuality filterQuality = FilterQuality.low,
A widget for showing video inside the Widget tree. This Widget is more performant compared to Video & uses flutter_native_view to embed the video output directly without any texture interop or pixel-buffer copy calls.
But, it is highly dependent on platform & other limitations apply. In general, this widget is more performant & should be used if possible.
An example configuration between a Player and a NativeVideo can be as follows.
Register the plugin with useFlutterNativeView
.
DartVLC.initilize(useFlutterNativeView: true);
Pass registerTexture
as false
when creating Player & use NativeVideo widget.
class _MyAppState extends State<MyApp> {
Player player = Player(id: 0, registerTexture: false);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: NativeVideo(
player: player,
height: 420.0,
width: 320.0
),
),
);
}
}
Supported Platforms
x
Windows
This Widget internally uses StreamController.
Prefer calling Player.stop & NativeVideo.dispose
to freed the resources.
A global Key may be used for this purpose.
Implementation
NativeVideo({
Key? key,
required Player player,
this.width,
this.height,
this.fit: BoxFit.contain,
this.alignment: Alignment.center,
this.scale: 1.0,
this.showControls: true,
this.progressBarActiveColor,
this.progressBarInactiveColor = Colors.white24,
this.progressBarThumbColor,
this.progressBarThumbGlowColor = const Color.fromRGBO(0, 161, 214, .2),
this.volumeActiveColor,
this.volumeInactiveColor = Colors.grey,
this.volumeBackgroundColor = const Color(0xff424242),
this.volumeThumbColor,
this.progressBarThumbRadius = 10.0,
this.progressBarThumbGlowRadius = 15.0,
this.showTimeLeft = false,
this.progressBarTextStyle = const TextStyle(),
this.filterQuality = FilterQuality.low,
}) : player = player,
super(key: key);