VideoView class
A widget that displays a native video player using the VideoLoaderFlutter class.
This widget uses native VideoLoaderFlutter (Android/iOS) to render videos with hardware acceleration and native controls.
Example:
VideoView(
videoUrl: 'https://example.com/video.mp4',
width: 300,
height: 200,
autoPlay: true,
looping: true,
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- VideoView
Constructors
- VideoView({Key? key, required String videoUrl, double? width, double? height, BoxFit? fit = BoxFit.contain, bool autoPlay = false, bool looping = false, bool showControls = true, VideoErrorCallback? onError, VoidCallback? onPlay, VoidCallback? onPause, VoidCallback? onMute, VoidCallback? onUnmute, VisibilityCallback? onVisibilityChanged, VoidCallback? on50PercentVisible, QuartileCallback? onQuartile, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, BoxDecoration? decoration, BorderRadiusGeometry? borderRadius})
-
const
Properties
- autoPlay → bool
-
Whether to auto-play the video when loaded (default: false)
final
- borderRadius → BorderRadiusGeometry?
-
Border radius for the video container
final
- decoration → BoxDecoration?
-
Decoration for the video container
final
- fit → BoxFit?
-
Fit mode for the video (kept for API compatibility, not used in native implementation)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
Height of the video player (optional, defaults to double.infinity)
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- looping → bool
-
Whether to loop the video (default: false) - currently always loops in native implementation
final
- margin → EdgeInsetsGeometry?
-
Margin around the video player
final
- on50PercentVisible → VoidCallback?
-
Callback when video reaches 50% visibility
final
- onError → VideoErrorCallback?
-
Callback when an error occurs
final
- onMute → VoidCallback?
-
Callback when video is muted
final
- onPause → VoidCallback?
-
Callback when video is paused
final
- onPlay → VoidCallback?
-
Callback when video starts playing
final
- onQuartile → QuartileCallback?
-
Callback when video reaches quartiles (25, 50, 75, 100)
final
- onUnmute → VoidCallback?
-
Callback when video is unmuted
final
- onVisibilityChanged → VisibilityCallback?
-
Callback when visibility changes (percentage 0-100)
final
- padding → EdgeInsetsGeometry?
-
Padding around the video player
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showControls → bool
-
Whether to show controls (default: true) - kept for API compatibility
final
- videoUrl → String
-
The URL of the video to play
final
- width → double?
-
Width of the video player (optional, defaults to double.infinity)
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< VideoView> -
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