VideoPlayerController class

Controls a platform video player, and provides updates when the state is changing.

Instances must be initialized with initialize.

The video is displayed in a Flutter app by creating a VideoPlayer widget.

To reclaim the resources used by the player call dispose.

After dispose all further calls are ignored.

Inheritance

Constructors

VideoPlayerController({PipFlutterPlayerBufferingConfiguration bufferingConfiguration = const PipFlutterPlayerBufferingConfiguration(), bool autoCreate = true})
Constructs a VideoPlayerController and creates video controller on platform side.

Properties

absolutePosition → Future<DateTime?>
The absolute position in the current video stream (i.e. EXT-X-PROGRAM-DATE-TIME in HLS).
no setter
bufferingConfiguration → PipFlutterPlayerBufferingConfiguration
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
position → Future<Duration?>
The position in the current video.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
textureId → int?
This is just exposed for testing. It shouldn't be used by anyone depending on the plugin.
no setter
value ↔ VideoPlayerValue
The current value stored in this notifier.
getter/setter pairinherited
videoEventStreamController → StreamController<VideoEvent>
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
disablePictureInPicture() → Future<void>
dispose() → Future<void>
Discards any resources used by the object.
override
enablePictureInPicture({double? top, double? left, double? width, double? height}) → Future<void>
isPictureInPictureSupported() → Future<bool?>
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.
refresh() → void
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 moment. The next time the video is played it will resume from the given moment.
setAssetDataSource(String dataSource, {String? package, bool? showNotification, String? title, String? author, String? imageUrl, String? notificationChannelName, Duration? overriddenDuration, String? activityName}) → Future<void>
Set data source for playing a video from an asset.
setAudioTrack(String? name, int? index) → void
setFileDataSource(File file, {bool? showNotification, String? title, String? author, String? imageUrl, String? notificationChannelName, Duration? overriddenDuration, String? activityName, String? clearKey}) → Future<void>
Set data source for playing a video from a file.
setLooping(bool looping) → Future<void>
Sets whether or not the video should loop after playing once. See also VideoPlayerValue.isLooping.
setMixWithOthers(bool mixWithOthers) → void
setNetworkDataSource(String dataSource, {VideoFormat? formatHint, Map<String, String?>? headers, bool useCache = false, int? maxCacheSize, int? maxCacheFileSize, String? cacheKey, bool? showNotification, String? title, String? author, String? imageUrl, String? notificationChannelName, Duration? overriddenDuration, String? licenseUrl, String? certificateUrl, Map<String, String>? drmHeaders, String? activityName, String? clearKey, String? videoExtension}) → Future<void>
Set data source for playing a video from obtained from the network.
setSpeed(double speed) → Future<void>
Sets the speed of this.
setTrackParameters(int? width, int? height, int? bitrate) → Future<void>
Sets the video track parameters of this
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

Static Methods

clearCache() → Future
preCache(DataSource dataSource, int preCacheSize) → Future
stopPreCache(String url, String? cacheKey) → Future