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?
optional onConnectionStateChange?: (state) => void;Called when the peer-connection state changes (plain string, no engine type).
Parameters
state
string
Returns
void
onLocalCandidate?
optional onLocalCandidate?: (candidate) => void;Called for each locally-gathered ICE candidate (trickle) — wire to your signaling layer.
Parameters
candidate
Returns
void
Methods
addRemoteCandidate()
addRemoteCandidate(candidate): Promise<void>;Add a remote trickle-ICE candidate.
Parameters
candidate
Returns
Promise<void>
close()
close(): Promise<void>;Tear down the peer and flush any file/muxer sink.
Returns
Promise<void>
createAnswer()
createAnswer(): Promise<WebRTCSessionDescription>;Build the SDP answer (camera-as-offerer flow).
Returns
Promise<WebRTCSessionDescription>
createOffer()
createOffer(): Promise<WebRTCSessionDescription>;Build the SDP offer (app-as-offerer flow: recv-only video + audio).
Returns
Promise<WebRTCSessionDescription>
setRemoteDescription()
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>