The signaling room whose membership and signal messages drive the mesh.
Call configuration (initial stream, ICE servers, codec, simulcast, etc.). Defaults to {}.
Publishes a screen-share track, applying the content hint and max bitrate from CallOptions.screenShare. Convenience over Call.addTrack.
The screen-capture track.
The stream the track belongs to.
Publishes a local track to every peer connection and registers it so it is also added to peers that join later. Emits MediaEvent.TrackPublished.
The local media track to send.
The stream the track belongs to.
Optionalopts: { contentHint?: string; maxBitrate?: number }Optional per-track overrides.
OptionalcontentHint?: stringEncoder content hint set on the track (e.g. "motion", "detail").
OptionalmaxBitrate?: numberMaximum send bitrate in bits per second; falls back to CallOptions.maxBitrate.
Permanently closes the call: stops active-speaker detection, clears local tracks, detaches room listeners, and closes every peer connection. Idempotent; a closed call cannot be restarted with Call.start.
Opens a data channel to a specific peer.
The target peer's id.
Data channel label.
Optionalopts: RTCDataChannelInitOptional data channel configuration.
The created data channel, or undefined if no connection to that peer exists.
Synchronously invokes every listener registered for event, in registration order.
true if at least one listener was invoked, false if there were none.
The listener list is snapshotted before dispatch, so mutations made by handlers take effect only on subsequent emissions. Listeners are isolated: if one throws, the remaining listeners still run and the error is surfaced via console.error rather than swallowed silently (consistent with LocalMessageBus).
Collects WebRTC statistics for one or all peer connections.
OptionalpeerId: stringIf given, returns stats for just that peer; otherwise for all connected peers.
A map of peer id to its RTCStatsReport.
Whether the local audio tracks are currently muted.
Whether the local video tracks are currently muted.
Returns the number of listeners currently registered for event.
The event name to count listeners for.
The count of registered listeners (0 if none).
Disables all local audio tracks (mutes the microphone) without renegotiating.
Disables all local video tracks (stops sending camera frames) without renegotiating.
Registers a listener that is invoked at most once: it is removed automatically before
being called the first time event is emitted.
This emitter, for chaining.
Remove a pending one-time listener by passing the same function reference to off.
Removes listeners for a single event, or for all events.
Optionalevent: keyof CallEventsThe event name to clear; if omitted, listeners for every event are removed.
This emitter, for chaining.
Unpublishes a track from every peer connection and removes it from the local registry.
The track to remove.
Replaces a published track with a new one on every peer connection without renegotiation (e.g. switching cameras). Updates the local track registry.
The currently published track.
The track to send in its place.
Tears down all connections and room listeners, then starts fresh. Local published tracks are preserved and re-added to the new connections. Invoked automatically when the room signals RoomEvent.Refreshed.
Starts the call: creates connections to all current peers and subscribes to room membership and signaling events. Idempotent, and a no-op once the call has been closed.
Starts polling remote audio levels and emitting MediaEvent.ActiveSpeaker when the dominant speaker changes. Idempotent.
Poll interval in milliseconds.
Stops active-speaker detection and releases its resources. Idempotent.
Re-enables all local audio tracks.
Re-enables all local video tracks.
Browser P2P mesh call over a signaling Room. Manages one PeerConnection per remote peer, wiring perfect negotiation, ICE, and track publishing so that adding a track fans it out to every peer.
It reacts to room membership: joining peers get a new connection, leaving peers are torn down, and a RoomEvent.Refreshed triggers a full Call.restart. All observable activity is surfaced as MediaEvents.
Remarks
Intended for small mesh calls where each participant connects directly to every other participant. For many-participant rooms, use the SFU (MediaService) instead.
Example