Skip to content

@mega-yfue/eufy-sdk / captureSnapshotFromShared

Function: captureSnapshotFromShared() ​

ts
function captureSnapshotFromShared(source, opts?): Promise<{
  height: number;
  jpeg: Buffer;
  width: number;
}>;

Live snapshot off a SHARED source (V6) — snapshot as just another consumer of the shared live pull. A warm source reuses its upstream session; collection starts from live keyframes rather than a retained picture. A live source captures its next keyframe by default; a cold source skips the first keyframe because its first IDR is frequently partial. Requires ffmpeg for the Annex-B → JPEG decode.

The returned dimensions are the ENCODED IMAGE's own, read back out of it — never the frame header's. The header states the stream's geometry when the capture started, and a stream that reconfigures mid-burst leaves it describing something the returned bytes contradict; the return value describes an image, so the image is its source of truth.

The consumer is detached the moment the collected run is complete, and the decode that follows holds no station: it works on bytes already in memory. One session serves one camera at a time and a still never opens a second one, so a still that kept its pull attached across its own decode would deny that station to every live request for the length of an FFmpeg run — measured on a real base as a live request refused 370ms after the still it was waiting on had already collected everything it needed.

signal ends the collection itself, not only the wait for it, and rejects with the signal's own reason because the abandonment is the caller's fact and not a failure of the source. It reaches only the collection: past that the station is already free, so there is nothing left for it to release.

Parameters ​

source ​

SharedLiveSource

opts? ​

collectMs? ​

number

ffmpegLevel? ​

| "debug" | "info" | "error" | "quiet" | "panic" | "fatal" | "warning" | "verbose" | "trace"

ffmpegPath? ​

string

logger? ​

Logger

signal? ​

AbortSignal

skipKeyframes? ​

number

timeoutMs? ​

number

Returns ​

Promise<{ height: number; jpeg: Buffer; width: number; }>

Independent and unofficial. Not affiliated with, endorsed by, or sponsored by Anker Innovations, Anker eufy, or eufy. "Anker eufy", "eufy" and "Anker" are trademarks of their respective owners. Use responsibly — rapid or failed logins can trigger captcha or temporary cooldowns.