@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
new VideoFrameDecoder(eccPrivateKey): VideoFrameDecoder;Parameters
eccPrivateKey
Buffer
the camera's 32-byte ECC private key (P-256 scalar).
Returns
VideoFrameDecoder
Accessors
currentMediaKey
Get Signature
get currentMediaKey(): Buffer<ArrayBufferLike> | undefined;The media key recovered from the most recent keyframe, if any.
Returns
Buffer<ArrayBufferLike> | undefined
Methods
decodeFrame()
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