FakeXVideoPlayerBackend class
In-memory backend for XVideoPlayerController tests. Swap in via
XVideoPlayerBackend.instance = FakeXVideoPlayerBackend() before
any UI mounts; restore with
XVideoPlayerBackend.instance = MethodChannelXVideoPlayerBackend()
in tearDown.
- Implemented types
Constructors
- FakeXVideoPlayerBackend({Size size = const Size(720, 1280), Duration duration = const Duration(seconds: 10), int rotationQuarterTurns = 0, int textureIdSeed = 100})
- Binds the metadata every player this backend creates reports.
Properties
-
createCalls
→ List<
String> -
URIs passed to create, in order.
final
- createError ↔ XVideoPlayerException?
-
If non-null, create throws this exception. Drives error paths.
getter/setter pair
-
disposeCalls
→ List<
int> -
Handles passed to disposeInstance, in order.
final
- duration ↔ Duration
-
Track length initialize reports.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initializeCalls
→ List<
int> -
Handles passed to initialize, in order.
final
- initializeError ↔ XVideoPlayerException?
-
If non-null, initialize throws this exception.
getter/setter pair
-
pauseCalls
→ List<
int> -
Handles passed to pause, in order.
final
-
playCalls
→ List<
int> -
Handles passed to play, in order.
final
- rotationQuarterTurns ↔ int
-
Display rotation initialize reports.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
seekToCalls
→ List<
({int handle, Duration position})> -
Arguments of every seekTo call, in order.
final
-
setLoopingCalls
→ List<
({int handle, bool loop})> -
Arguments of every setLooping call, in order.
final
-
setPlaybackSpeedCalls
→ List<
({int handle, double rate})> -
Arguments of every setPlaybackSpeed call, in order.
final
-
setVolumeCalls
→ List<
({int handle, double volume})> -
Arguments of every setVolume call, in order.
final
- size ↔ Size
-
Pixel dimensions initialize reports.
getter/setter pair
- textureIdSeed ↔ int
-
Base the texture ids count up from, one per created player.
getter/setter pair
Methods
-
create(
{required String uri}) → Future< XVideoPlayerCreateResult> -
Allocate a native player instance bound to
uri(file://...for local playback, or an http(s) URL for network streaming). Returns the handle and the Flutter texture id the player renders into.override -
disposeInstance(
int handle) → Future< void> -
Tear down the session. Releases the codec and any held surface /
texture. Safe to call repeatedly; no-op once disposed.
override
-
emitCompleted(
int handle) → void -
Pushes end-of-track for
handle. -
emitError(
int handle, String code, [String? description]) → void -
Pushes a playback error for
handle. -
emitSizeChanged(
int handle, Size size) → void -
Pushes a revised video size for
handle. -
emitState(
int handle, {bool? isPlaying, bool? isBuffering, Duration? position, List< XDurationRange> ? buffered}) → void -
Pushes a state change for
handle; omitted fields stay as they are. -
events(
int handle) → Stream< XVideoPlayerEvent> -
Live event stream for
handle. The controller subscribes during create / initialize and unsubscribes on disposeInstance.override -
initialize(
int handle) → Future< XVideoPlayerMetadata> -
Load the media. Resolves once the codec is configured and metadata
(size, duration) is known. Throws
XVideoPlayerException("decode_failed") if the file can't be
opened or the codec init failed permanently.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
int handle) → Future< void> -
Halt playback, leaving the playhead where it is.
override
-
play(
int handle) → Future< void> -
Start or resume playback.
override
-
seekTo(
int handle, Duration position) → Future< void> -
Move the playhead to
position.override -
setLooping(
int handle, bool loop) → Future< void> -
Set whether the track restarts on reaching its end.
override
-
setPlaybackSpeed(
int handle, double rate) → Future< void> -
Set playback rate, where 1 is real time.
override
-
setVolume(
int handle, double volume) → Future< void> -
Set playback gain, from 0 to 1.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited