Skip to content

eufy-mega / core/contracts / WebRTCPeerHandle

Interface: WebRTCPeerHandle

Engine-free structural surface of a WebRTC peer — a STRUCTURAL subset of the concrete transport/webrtc peer, so the WebRTC boundary lives in core WITHOUT dragging the engine (werift) type surface (RTCPeerConnection, MediaStreamTrack, RtpPacket, …) into the public .d.ts. Signaling in / media out (to a file / a plain callback); no engine handle is exposed. The engine is lazy-loaded only when a concrete peer is constructed, so a host that never opens a WebRTC stream never pays the WebRTC engine's import cost.

Properties

onConnectionStateChange?

ts
optional onConnectionStateChange?: (state) => void;

Called when the peer-connection state changes (plain string, no engine type).

Parameters

state

string

Returns

void


onLocalCandidate?

ts
optional onLocalCandidate?: (candidate) => void;

Called for each locally-gathered ICE candidate (trickle) — wire to your signaling layer.

Parameters

candidate

WebRTCIceCandidate

Returns

void

Methods

addRemoteCandidate()

ts
addRemoteCandidate(candidate): Promise<void>;

Add a remote trickle-ICE candidate.

Parameters

candidate

WebRTCIceCandidate

Returns

Promise<void>


close()

ts
close(): Promise<void>;

Tear down the peer and flush any file/muxer sink.

Returns

Promise<void>


createAnswer()

ts
createAnswer(): Promise<WebRTCSessionDescription>;

Build the SDP answer (camera-as-offerer flow).

Returns

Promise<WebRTCSessionDescription>


createOffer()

ts
createOffer(): Promise<WebRTCSessionDescription>;

Build the SDP offer (app-as-offerer flow: recv-only video + audio).

Returns

Promise<WebRTCSessionDescription>


setRemoteDescription()

ts
setRemoteDescription(sdp, type): Promise<void>;

Apply the remote description (the camera's answer, or its offer in the camera-as-offerer flow).

Parameters

sdp

string

type

"answer" | "offer"

Returns

Promise<void>

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