XVideoPlayerController class
Owns one native video-player session. The surface mirrors the
subset of package:video_player's VideoPlayerController the app
currently uses — the .file(...) / .network(...) constructors, the
standard playback controls, and the value getters compose /
gallery / outgoing-media read.
Lifecycle: construct → initialize → use → dispose. After dispose every other method throws XVideoPlayerException("disposed"), and so does a call the native side answers after dispose.
- Inheritance
-
- Object
- ChangeNotifier
- XVideoPlayerController
- Implemented types
- Available extensions
Constructors
- XVideoPlayerController.file(File file)
- Play a local file.
- XVideoPlayerController.network(Uri uri)
-
Stream from a network URL. The native side hands the URI straight
to Media3 (Android,
MediaItem.fromUri) /AVURLAsset(Apple) / Media Foundation's media engine (Windows), each of which streams http(s) natively — no extra setup.
Properties
- handle → int?
-
Native handle once initialize has resolved. Null otherwise.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textureId → int?
-
Flutter texture id the player renders into. Null until initialize
has created the native session.
no setter
- value → XVideoPlayerValue
-
The current value of the object.
no setteroverride
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
buildPlayer(
) → Widget -
Texture-backed render widget. Equivalent to
VideoPlayer(controller)— wrap inAspectRatioto control framing. -
dispose(
) → Future< void> -
Discards any resources used by the object.
override
-
initialize(
) → Future< void> -
Configure the native session and load the file. Resolves once the
codec is ready and
value.size/value.durationare populated. Throws if the file is missing, unreadable, or unsupported. -
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> - Halts playback, leaving the playhead where it is.
-
play(
) → Future< void> - Starts or resumes playback.
-
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> - Moves the playhead, clamped into the track.
-
setLooping(
bool loop) → Future< void> - Sets whether the track restarts on reaching its end.
-
setPlaybackSpeed(
double rate) → Future< void> - Sets playback rate, clamped to 0.25–4.
-
setVolume(
double volume) → Future< void> - Sets playback gain, clamped to 0–1.
-
subscribe(
VoidCallback callback) → VoidCallback -
Available on Listenable, provided by the ListenableExtension extension
Addscallbackas listener and returns a function to remove it. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited