WebRTC

Functions

Public API reference for the WebRTC extension

Extension Construction

FunctionDescription
New(streamingExt, config, opts...) (*Extension, error)Create the WebRTC extension with a streaming dependency

Peer Connections

FunctionDescription
NewPeerConnection(id, userID, config, logger) (PeerConnection, error)Create a new WebRTC peer connection
NewLocalTrack(kind, id, label, logger) (MediaTrack, error)Create a local media track

Signaling

FunctionDescription
NewSignalingManager(streamingExt, logger) SignalingManagerCreate a signaling manager using streaming rooms

Call Rooms

FunctionDescription
NewMeshCallRoom(roomID, streamingRoom, logger, metrics, config) CallRoomCreate a mesh (P2P) call room
NewMeshCallRoomFromOptions(roomID, streamingRoom, logger, metrics, config) (CallRoom, error)Create a mesh room with validation
NewSFUCallRoomFromOptions(roomID, streamingRoom, logger, metrics, config) (CallRoom, error)Create an SFU call room

SFU

FunctionDescription
NewSFURouter(roomID, logger, metrics) SFURouterCreate an SFU media router

Quality

FunctionDescription
NewQualityMonitor(peerID, peer, config, logger, metrics) QualityMonitorCreate a quality monitor for a peer

CallRoom Interface

MethodDescription
Join(ctx, conn, options) errorAdd a participant to the call
Leave(ctx, conn) errorRemove a participant
GetParticipants() []ParticipantList current participants
GetParticipant(userID) (*Participant, error)Get a specific participant

PeerConnection Interface

MethodDescription
CreateOffer() (*SessionDescription, error)Generate an SDP offer
CreateAnswer() (*SessionDescription, error)Generate an SDP answer
SetLocalDescription(sdp) errorSet the local SDP
SetRemoteDescription(sdp) errorSet the remote SDP
AddICECandidate(candidate) errorAdd an ICE candidate
AddTrack(track) errorAdd a media track
RemoveTrack(trackID) errorRemove a media track
CreateDataChannel(label, options) (DataChannel, error)Create a data channel
GetStats() PeerStatsGet connection statistics
Close() errorClose the peer connection

SignalingManager Interface

MethodDescription
SendOffer(ctx, roomID, targetID, offer) errorSend an SDP offer
SendAnswer(ctx, roomID, targetID, answer) errorSend an SDP answer
SendICECandidate(ctx, roomID, targetID, candidate) errorSend an ICE candidate

QualityMonitor Interface

MethodDescription
Start(ctx) errorStart monitoring
Stop() errorStop monitoring
GetQuality() CallQualityGet current quality assessment
GetConnectionQuality() ConnectionQualityGet connection quality metrics

How is this guide?

On this page