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. If the source is already warm and has a cached keyframe (V2 keyframe-prime), the joining consumer receives that IDR immediately and we decode it with no extra pull — a snapshot while someone else watches costs nothing on the wire. Otherwise we warm the source and wait for a clean keyframe (the first IDR after a cold start is frequently partial, so skip it by default). 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.

Parameters

source

SharedLiveSource

opts?

collectMs?

number

ffmpegLevel?

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

ffmpegPath?

string

logger?

Logger

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.