Documentation ¶
Index ¶
- Variables
- type Message
- type Options
- type Peer
- func (p *Peer) AddTrack(receiver *webrtc.RTPReceiver, remoteTrack *webrtc.TrackRemote, ...) (*webrtc.RTPSender, error)
- func (p *Peer) Answer(request []byte) ([]byte, error)
- func (p *Peer) Close() error
- func (p *Peer) CreateDataChannel(label string) (*webrtc.DataChannel, error)
- func (p *Peer) Emit(event string, data []byte) error
- func (p *Peer) ID() string
- func (p *Peer) LocalTracks() []webrtc.TrackLocal
- func (p *Peer) Offer(signalFn func(meta PeerMeta, signal []byte) ([]byte, error)) error
- func (p *Peer) OnClose(fn func())
- func (p *Peer) OnDataChannel(f func(channel *webrtc.DataChannel))
- func (p *Peer) OnReady(f func())
- func (p *Peer) OnRequest(f func(event string, msg Message))
- func (p *Peer) OnTrack(...)
- func (p *Peer) Request(ctx context.Context, event string, data []byte) ([]byte, error)
- func (p *Peer) WriteRTCP(pkts []rtcp.Packet) error
- type PeerConfig
- type PeerMeta
- type TrackMeta
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) AddTrack ¶
func (p *Peer) AddTrack(receiver *webrtc.RTPReceiver, remoteTrack *webrtc.TrackRemote, localTrack webrtc.TrackLocal) (*webrtc.RTPSender, error)
AddTrack is used to negotiate a track to the remote peer
func (*Peer) CreateDataChannel ¶
CreateDataChannel creates a new DataChannel object with the given label
func (*Peer) LocalTracks ¶
func (p *Peer) LocalTracks() []webrtc.TrackLocal
func (*Peer) Offer ¶
Offer is used for establish the connection of the local relay Peer with the remote relay Peer.
If connection is successful OnReady handler will be called
func (*Peer) OnClose ¶
func (p *Peer) OnClose(fn func())
OnClose sets a callback that is called when relay Peer is closed.
func (*Peer) OnDataChannel ¶
func (p *Peer) OnDataChannel(f func(channel *webrtc.DataChannel))
OnDataChannel sets an event handler which is invoked when a data channel message arrives from a remote Peer.
func (*Peer) OnReady ¶
func (p *Peer) OnReady(f func())
OnReady calls the callback when relay Peer is ready to start sending/receiving and creating DC
func (*Peer) OnRequest ¶
OnRequest calls the callback when Peer gets a request message from remote Peer
func (*Peer) OnTrack ¶
func (p *Peer) OnTrack(f func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver, meta *TrackMeta))
OnTrack sets an event handler which is called when remote track arrives from a remote Peer