@mega-yfue/eufy-sdk / LiveConsumer
Interface: LiveConsumer
A single consumer of a SharedLiveSource. A LiveStreamConsumer (so live() can hand it back directly), plus the listener removal and arrival-timed feed the recording and readable egresses use.
Extends
Properties
awaitingKeyframe
readonly awaitingKeyframe: boolean;True while this consumer is dropping frames after crossing its bound, waiting for the next IDR.
Inherited from
LiveStreamConsumer.awaitingKeyframe
primed
readonly primed: boolean;True once the source has replayed a cached keyframe to this consumer (no GOP wait on join).
Methods
detach()
detach(): void;Leave the source (refcount--). Idempotent. stop() is an alias (LiveStreamHandle).
Returns
void
nudge()?
optional nudge(force?): void;Re-issue the media-start command (start-race retry / keepalive nudge). Optional.
force states that the channel is NOT being served, so a real start is required rather than a keepalive. An own-session camera sends one or the other depending on whether its session believes the channel is already started — a belief that outlives a station which acknowledged a start and then served nothing.
Parameters
force?
boolean
Returns
void
Inherited from
off()
Call Signature
off(event, listener): this;Detach a previously registered listener (mirrors LiveStreamHandle.on).
Parameters
event
"video"
listener
(frame) => void
Returns
this
Call Signature
off(event, listener): this;Parameters
event
"audio"
listener
(frame) => void
Returns
this
Call Signature
off(event, listener): this;Parameters
event
"start" | "stop"
listener
() => void
Returns
this
Call Signature
off(event, listener): this;Parameters
event
"error"
listener
(err) => void
Returns
this
on()
Call Signature
on(event, listener): this;The coded configuration of the video that follows, announced immediately before the first frame carrying it and again whenever it changes.
A camera reconfigures its source repeatedly within one session, and an encoder opened for one geometry cannot accept a frame of another — so a consumer adapting this source to a fixed output has to rebuild on every change. Fires once per change rather than per frame, beginning with the first frame this consumer receives, so a consumer holding media it has not been told the configuration of is not a state it can reach.
Per consumer, against what THIS consumer was last given: a consumer that joins mid-session is primed with a cached keyframe it did not witness arriving, and one that crosses its bound resynchronises onto a later IDR having skipped the frame the source saw the change on. Announcing what the source saw would leave both holding an encoder built for media they never received.
Only a consumer announces this, never a bare LiveStreamHandle: it is read from the parameter sets a shared source watches every frame for, which the raw pull underneath it does not do. That is also why the inherited events are restated here — a subtype may add an overload only by declaring the whole set.
Parameters
event
"video-config"
listener
(config) => void
Returns
this
Inherited from
Call Signature
on(event, listener): this;One whole video access unit — see LiveVideoFrame.
Parameters
event
"video"
listener
(frame) => void
Returns
this
Inherited from
Call Signature
on(event, listener): this;One audio access unit, in the codec the station declared for it.
Parameters
event
"audio"
listener
(frame) => void
Returns
this
Inherited from
Call Signature
on(event, listener): this;Battery-budget elapsed — extend to keep streaming or let it auto-stop (battery cameras only).
Parameters
event
"start" | "stop"
listener
() => void
Returns
this
Inherited from
Call Signature
on(event, listener): this;Why this consumer's stream is over, including a warm-up that never produced a keyframe.
Parameters
event
"error"
listener
(err) => void
Returns
this
Inherited from
Call Signature
on(event, listener): this;Battery-budget elapsed — extend to keep streaming or let it auto-stop (battery cameras only).
Parameters
event
"budget"
listener
(notice) => void
Returns
this
Inherited from
Call Signature
on(event, listener): this;A media start was repeated to its acknowledgement deadline and abandoned.
The start is repeated byte-identically, so an abandonment is many sends with no reply — the device was never told to stream, and a warm-up waiting on it can only time out. Distinct from error: the transport is intact and the session is simply not being heard.
Parameters
event
"unacknowledged"
listener
() => void
Returns
this
Inherited from
onMedia()
onMedia(listener): this;Subscribe to frames carrying the source-captured arrival time used by the prebuffer.
Parameters
listener
(item) => void
Returns
this
pause()
pause(): void;Hold delivery — frames queue against the bound until resume.
Returns
void
Inherited from
resume()
resume(): void;Release delivery and hand over the queued backlog, stopping if the sink pauses again mid-drain.
Returns
void
Inherited from
start()
start(): this;Returns
this
Inherited from
stop()
stop(): void;Returns
void