VideoPlayerController class

A very minimal version of VideoPlayerController for running the example without relying on video_player.

Inheritance
Available extensions

Constructors

VideoPlayerController.asset(String dataSource, {String? package, VideoViewType viewType = VideoViewType.textureView})
Constructs a VideoPlayerController playing a video from an asset.
VideoPlayerController.file(File file, {VideoViewType viewType = VideoViewType.textureView})
Constructs a VideoPlayerController playing a video from obtained from a file.
VideoPlayerController.network(String dataSource, {VideoViewType viewType = VideoViewType.textureView})
Constructs a VideoPlayerController playing a video from obtained from the network.

Properties

dataSource String
The URI to the video file. This will be in different formats depending on the DataSourceType of the original video.
final
dataSourceType → DataSourceType
Describes the type of data source this VideoPlayerController is constructed with.
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
onPipModeChanged Stream<bool>

Available on VideoPlayerController, provided by the VideoPlayerControllerExtension extension

Stream of PiP mode state changes.
no setter
package String?
Only set for asset videos. The package that the asset was loaded from.
final
playerId int
This is just exposed for testing. It shouldn't be used by anyone depending on the plugin.
no setter
position Future<Duration?>
The position in the current video.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value VideoPlayerValue
The current value stored in this notifier.
getter/setter pairinherited
viewType → VideoViewType
The type of view used to display the video.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() Future<void>
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
enterPipMode({int? width, int? height}) Future<bool>

Available on VideoPlayerController, provided by the VideoPlayerControllerExtension extension

Enters PiP mode for the specified player ID.
exitPipMode() Future<bool>

Available on VideoPlayerController, provided by the VideoPlayerControllerExtension extension

Exits PiP mode.
getIsBuffering() bool
Gets the current buffering state of the video player.
initialize() Future<void>
Attempts to open the given dataSource and load metadata about the video.
isInPipMode() Future<bool>

Available on VideoPlayerController, provided by the VideoPlayerControllerExtension extension

Checks if the app is currently in PiP mode.
isPipSupported() Future<bool>

Available on VideoPlayerController, provided by the VideoPlayerControllerExtension extension

Checks if the device supports PiP mode.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pause() Future<void>
Pauses the video.
play() Future<void>
Starts playing the video.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
seekTo(Duration position) Future<void>
Sets the video's current timestamp to be at position.
setLooping(bool looping) Future<void>
Sets whether or not the video should loop after playing once. See also VideoPlayerValue.isLooping.
setPlaybackSpeed(double speed) Future<void>
Sets the playback speed.
setVolume(double volume) Future<void>
Sets the audio volume of this.
toString() String
A string representation of this object.
inherited

Operators

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

Constants

kUninitializedPlayerId → const int
The id of a player that hasn't been initialized.