Skip to content

@mega-yfue/eufy-sdk / VideoFrameDecoder

Class: VideoFrameDecoder ​

Decodes a single P2P video stream into H.264. Construct one per stream with the camera's 32-byte ECC private key; feed it CMD_VIDEO_FRAME payloads in order. Keyframes re-key the decoder via their ECIES envelope; P/B-frames reuse the cached media key. All failure modes (short/garbage frame, wrong key, tampered HMAC, GCM auth failure) return undefined — the decoder never throws.

Constructors ​

Constructor ​

ts
new VideoFrameDecoder(eccPrivateKey): VideoFrameDecoder;

Parameters ​

eccPrivateKey ​

Buffer

the camera's 32-byte ECC private key (P-256 scalar).

Returns ​

VideoFrameDecoder

Accessors ​

currentMediaKey ​

Get Signature ​

ts
get currentMediaKey(): Buffer<ArrayBufferLike> | undefined;

The media key recovered from the most recent keyframe, if any.

Returns ​

Buffer<ArrayBufferLike> | undefined

Methods ​

decodeFrame() ​

ts
decodeFrame(payload): DecodedVideoFrame | undefined;

Decode one video frame. Returns the keyframe flag and decrypted H.264 bytes, or undefined if the frame is malformed, the envelope/key is wrong, or GCM authentication fails.

Parameters ​

payload ​

Buffer

Returns ​

DecodedVideoFrame | undefined

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.