NativeVideo class

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.

Inheritance

Constructors

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.

Properties

alignment AlignmentGeometry
How to align the picture box within the player viewport. Defaults to Alignment.center
final
filterQuality FilterQuality
Filter quality.
final
fit BoxFit
How to inscribe the picture box into the player viewport. Defaults to BoxFit.contain.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Height of the viewport. Defaults to the height of the parent.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
player Player
The Player whose NativeVideo output should be shown.
final
progressBarActiveColor Color?
Active color of the progress bar
final
progressBarInactiveColor Color?
Inactive color of the progress bar
final
progressBarTextStyle TextStyle
TextStyle for the Progress Bar
final
progressBarThumbColor Color?
Thumb color of the progress bar
final
progressBarThumbGlowColor Color?
Thumb's glow color of the progress bar
final
progressBarThumbGlowRadius double?
Radius of the progressbar's glow of the thumb
final
progressBarThumbRadius double?
Radius of the progressbar's thumb
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scale double
Scale.
final
showControls bool
Built-In video controls.
final
showTimeLeft bool
If you want the progress bar to display the time left while playing instead of the total time, set this to true
final
volumeActiveColor Color?
Active color of the volume slider
final
volumeBackgroundColor Color
Background color of the volume slider
final
volumeInactiveColor Color?
Inactive color of the volume slider
final
volumeThumbColor Color?
Thumb color of the volume slider
final
width double?
Width of the viewport. Defaults to the width of the parent.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _NativeVideoState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited