Video class

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,
      ),
    );
  }
}
Inheritance

Constructors

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, bool resumeUponEnteringForegroundMode = false, SubtitleViewConfiguration subtitleViewConfiguration = const SubtitleViewConfiguration(), Future<void> onEnterFullscreen() = defaultEnterNativeFullscreen, Future<void> onExitFullscreen() = defaultExitNativeFullscreen})
Video
const

Properties

alignment Alignment
Alignment of the viewport.
final
aspectRatio double?
Preferred aspect ratio of the viewport.
final
controller VideoController
The VideoController reference to control this Video output.
final
controls VideoControlsBuilder?
Video controls builder.
final
fill Color
Background color to fill the video background.
final
filterQuality FilterQuality
Filter quality of the Texture widget displaying the video output.
final
fit BoxFit
Fit of the viewport.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Height of this viewport.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onEnterFullscreen Future<void> Function()
The callback invoked when the Video enters fullscreen.
final
onExitFullscreen Future<void> Function()
The callback invoked when the Video exits fullscreen.
final
pauseUponEnteringBackgroundMode bool
Whether to pause the video when application enters background mode.
final
resumeUponEnteringForegroundMode bool
Whether to resume the video when application enters foreground mode.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subtitleViewConfiguration SubtitleViewConfiguration
The configuration for subtitles e.g. TextStyle & padding etc.
final
wakelock bool
Whether to acquire wake lock while playing the video.
final
width double?
Width of this viewport.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<Video>
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, int wrapWidth = 65}) 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