Documentation
¶
Index ¶
- Variables
- type DataChannelAvailable
- type DataChannelMessage
- type ICEGatheringComplete
- type JoinedTheCall
- type LeftTheCall
- type MessageContent
- type NewICECandidate
- type NewTrackPublished
- type Peer
- func (p *Peer[ID]) AddTrack(track *webrtc.TrackLocalStaticRTP) (*webrtc.RTPSender, error)
- func (p *Peer[ID]) ProcessNewRemoteCandidates(candidates []webrtc.ICECandidateInit)
- func (p *Peer[ID]) ProcessSDPAnswer(sdpAnswer string) error
- func (p *Peer[ID]) ProcessSDPOffer(sdpOffer string) (*webrtc.SessionDescription, error)
- func (p *Peer[ID]) RemoveTrack(sender *webrtc.RTPSender) error
- func (p *Peer[ID]) RequestKeyFrame(track *webrtc.TrackRemote) error
- func (p *Peer[ID]) SendOverDataChannel(json string) error
- func (p *Peer[ID]) Terminate()
- type RenegotiationRequired
Constants ¶
This section is empty.
Variables ¶
var ( ErrCantCreatePeerConnection = errors.New("can't create peer connection") ErrCantSetRemoteDescription = errors.New("can't set remote description") ErrCantCreateAnswer = errors.New("can't create answer") ErrCantSetLocalDescription = errors.New("can't set local description") ErrCantCreateLocalDescription = errors.New("can't create local description") ErrDataChannelNotAvailable = errors.New("data channel is not available") ErrDataChannelNotReady = errors.New("data channel is not ready") ErrCantSubscribeToTrack = errors.New("can't subscribe to track") )
Functions ¶
This section is empty.
Types ¶
type DataChannelAvailable ¶
type DataChannelAvailable struct{}
type DataChannelMessage ¶
type DataChannelMessage struct {
Message string
}
type ICEGatheringComplete ¶
type ICEGatheringComplete struct{}
type JoinedTheCall ¶
type JoinedTheCall struct{}
type LeftTheCall ¶
type LeftTheCall struct {
Reason event.CallHangupReason
}
type MessageContent ¶
type MessageContent = interface{}
Due to the limitation of Go, we're using the `interface{}` to be able to use switch the actual type of the message on runtime. The underlying types do not necessary need to be structures.
type NewICECandidate ¶
type NewICECandidate struct {
Candidate *webrtc.ICECandidate
}
type NewTrackPublished ¶
type NewTrackPublished struct {
// Remote track that has been published.
RemoteTrack *webrtc.TrackRemote
}
type Peer ¶
type Peer[ID comparable] struct { // contains filtered or unexported fields }
A wrapped representation of the peer connection (single peer in the call). The peer gets information about the things happening outside via public methods and informs the outside world about the things happening inside the peer by posting the messages to the channel.
func NewPeer ¶
func NewPeer[ID comparable]( connectionFactory *webrtc_ext.PeerConnectionFactory, sdpOffer string, sink *channel.SinkWithSender[ID, MessageContent], logger *logrus.Entry, ) (*Peer[ID], *webrtc.SessionDescription, error)
Instantiates a new peer with a given SDP offer and returns a peer and the SDP answer if everything is ok.
func (*Peer[ID]) ProcessNewRemoteCandidates ¶
func (p *Peer[ID]) ProcessNewRemoteCandidates(candidates []webrtc.ICECandidateInit)
Processes the remote ICE candidates.
func (*Peer[ID]) ProcessSDPAnswer ¶
Processes the SDP answer received from the remote peer.
func (*Peer[ID]) ProcessSDPOffer ¶
Applies the sdp offer received from the remote peer and generates an SDP answer.
func (*Peer[ID]) RemoveTrack ¶
Implementation of the `SubscriptionController` interface.
func (*Peer[ID]) RequestKeyFrame ¶
Request a key frame from the peer connection.
func (*Peer[ID]) SendOverDataChannel ¶
Tries to send the given message to the remote counterpart of our peer.
type RenegotiationRequired ¶
type RenegotiationRequired struct {
Offer *webrtc.SessionDescription
}