WebRTC
Functions
Public API reference for the WebRTC extension
| Function | Description |
|---|
New(streamingExt, config, opts...) (*Extension, error) | Create the WebRTC extension with a streaming dependency |
| Function | Description |
|---|
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 |
| Function | Description |
|---|
NewSignalingManager(streamingExt, logger) SignalingManager | Create a signaling manager using streaming rooms |
| Function | Description |
|---|
NewMeshCallRoom(roomID, streamingRoom, logger, metrics, config) CallRoom | Create 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 |
| Function | Description |
|---|
NewSFURouter(roomID, logger, metrics) SFURouter | Create an SFU media router |
| Function | Description |
|---|
NewQualityMonitor(peerID, peer, config, logger, metrics) QualityMonitor | Create a quality monitor for a peer |
| Method | Description |
|---|
Join(ctx, conn, options) error | Add a participant to the call |
Leave(ctx, conn) error | Remove a participant |
GetParticipants() []Participant | List current participants |
GetParticipant(userID) (*Participant, error) | Get a specific participant |
| Method | Description |
|---|
CreateOffer() (*SessionDescription, error) | Generate an SDP offer |
CreateAnswer() (*SessionDescription, error) | Generate an SDP answer |
SetLocalDescription(sdp) error | Set the local SDP |
SetRemoteDescription(sdp) error | Set the remote SDP |
AddICECandidate(candidate) error | Add an ICE candidate |
AddTrack(track) error | Add a media track |
RemoveTrack(trackID) error | Remove a media track |
CreateDataChannel(label, options) (DataChannel, error) | Create a data channel |
GetStats() PeerStats | Get connection statistics |
Close() error | Close the peer connection |
| Method | Description |
|---|
SendOffer(ctx, roomID, targetID, offer) error | Send an SDP offer |
SendAnswer(ctx, roomID, targetID, answer) error | Send an SDP answer |
SendICECandidate(ctx, roomID, targetID, candidate) error | Send an ICE candidate |
| Method | Description |
|---|
Start(ctx) error | Start monitoring |
Stop() error | Stop monitoring |
GetQuality() CallQuality | Get current quality assessment |
GetConnectionQuality() ConnectionQuality | Get connection quality metrics |
How is this guide?