Documentation
¶
Overview ¶
Package peer owns the PeerConnection and the offer/answer exchange. It sends descriptions and candidates through a Signaler, so the same code can negotiate over the signaling server or, later, over the data channel.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Codecs *mediadevices.CodecSelector
Signaler Signaler
ChannelLabel string
OnTrack func(*webrtc.TrackRemote)
OnDataChannel func(*webrtc.DataChannel) // both the one created here and the one received
// OnSendersReady runs once the descriptions have started the RTP senders.
OnSendersReady func()
// OnEnded runs when the connection closes or fails, possibly more than once.
OnEnded func()
}
Config wires the connection to the rest of the client. The callbacks run on pion goroutines, except OnSendersReady, which runs inside Handle.
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
Peer is one side of the call.
func New ¶
New builds the PeerConnection with the given codecs and hooks up the callbacks. Nothing is sent until Handle gets a peer_joined or an offer.
func (*Peer) Conn ¶
func (p *Peer) Conn() *webrtc.PeerConnection
Conn returns the underlying connection, for adding tracks and transceivers before the first offer.
func (*Peer) RTT ¶
RTT is the latest round trip ICE measured on the path in use. ok is false until a path exists.
func (*Peer) State ¶
func (p *Peer) State() webrtc.PeerConnectionState
State reports the state of the peer connection.