MovaFirstFrameGate class

Decides when one playback attempt has actually started presenting media.

Pure logic: no Timer, no clock. The owner feeds observations and starts the grace timer itself when awaitingGrace turns true. Every onXxx returns the landing signal exactly once, or null.

判定一次播放尝试何时真正开始呈现媒体。

纯逻辑:无 Timer、无时钟。持有者喂观测,并在 awaitingGrace 变 true 时自己 起宽限计时。每个 onXxx 只在落地那一次返回信号,否则返回 null。

Example / 示例:

final gate = MovaFirstFrameGate()..arm(autoPlay: true);
gate.onBuffering(true, nativeLive: false);           // null
gate.onBuffering(false, nativeLive: false);          // MovaFirstFrameSignal.buffering

Constructors

MovaFirstFrameGate()

Properties

armed → bool
Whether an attempt is armed (landed or not).
no setter
awaitingGrace → bool
True once a fallback fired while the native signal was live and the attempt is still waiting for a restart — the owner should start a grace timer and call onGraceExpired when it fires.
no setter
hashCode → int
The hash code for this object.
no setterinherited
landed → bool
Whether the current attempt has landed.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

arm({required bool autoPlay, bool resume = false}) → void
Arms a fresh attempt; autoPlay false enables the size fallback. resume true arms a keepAlive-resume attempt instead: only a native restart or a non-zero size lands it, immediately (no grace, regardless of autoPlay); buffering and position are ignored because playback kept moving during keepAlive.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onBuffering(bool buffering, {required bool nativeLive}) → MovaFirstFrameSignal?
Feeds a buffering flag; lands only on a true→false edge.
onGraceExpired() → MovaFirstFrameSignal?
Lands the attempt via MovaFirstFrameSignal.grace if still waiting.
onProgress(Duration position, {required bool nativeLive}) → MovaFirstFrameSignal?
Feeds a position; lands on the second consecutive increase above zero.
onRestart() → MovaFirstFrameSignal?
Feeds a native restart; always authoritative.
onSize(int width, int height, {required bool nativeLive}) → MovaFirstFrameSignal?
Feeds a video size; lands only for a paused open on the first non-zero size.
reset() → void
Disarms everything.
toString() → String
A string representation of this object.
inherited

Operators

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