Documentation
¶
Index ¶
- Constants
- type MediaSource
- type Peer
- type PeerSet
- type SignallingServer
- func (s *SignallingServer) Connect()
- func (s *SignallingServer) Disconnect()
- func (s *SignallingServer) OnAnswer(f func(answer webrtc.SessionDescription))
- func (s *SignallingServer) OnError(f func(err error))
- func (s *SignallingServer) OnIceCandidate(f func(candidate webrtc.ICECandidateInit))
- func (s *SignallingServer) OnOffer(f func(offer webrtc.SessionDescription))
- func (s *SignallingServer) OnPeerConnect(f func())
- func (s *SignallingServer) OnPeerDisconnect(f func())
- func (s *SignallingServer) SendAnswer(answer webrtc.SessionDescription)
- func (s *SignallingServer) SendIceCandidate(candidate webrtc.ICECandidateInit)
- func (s *SignallingServer) SendOffer(offer webrtc.SessionDescription)
Constants ¶
View Source
const ( Disconnected = iota Connecting Connected )
Connection state.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MediaSource ¶
type MediaSource struct {
// contains filtered or unexported fields
}
func CreateRtspMediaSource ¶
func CreateRtspMediaSource(rtspUrl string) (*MediaSource, error)
func CreateVideoMediaSource ¶
func CreateVideoMediaSource(codec *codec.Codec, width, height int) (*MediaSource, error)
type Peer ¶
type Peer interface {
Connect()
Disconnect()
OnConnectionStateChange(f func(connectionState int))
OnStringMessage(f func(message string))
OnBinaryMessage(f func(message []byte))
OnError(f func(err error))
SendStringMessage(message string)
SendBinaryMessage(message []byte)
}
Peer represents a connection (attempted or actual) to a ThingRTC peer.
func NewPeerWithMedia ¶
func NewPeerWithMedia(serverUrl string, tokenGenerator pairing.TokenGenerator, sources ...*MediaSource) Peer
type PeerSet ¶
type PeerSet struct {
// contains filtered or unexported fields
}
func NewPeerSet ¶
func (*PeerSet) Disconnect ¶
func (p *PeerSet) Disconnect()
type SignallingServer ¶
type SignallingServer struct {
URL string
TokenGenerator pairing.TokenGenerator
// contains filtered or unexported fields
}
SignallingServer handles signalling communications to establish a connection between peers. It is conceptually simple in that it can connect to a server (handling auth messages etc), send and receive messages, and disconnect from a server. If there are any failures in the connection or processing of messages, it will report these and return to a disconnected state.
func NewSignallingServer ¶
func NewSignallingServer(serverUrl string, tokenGenerator pairing.TokenGenerator) SignallingServer
func (*SignallingServer) Connect ¶
func (s *SignallingServer) Connect()
Attempt to connect with a signalling server and exchange peer details.
func (*SignallingServer) Disconnect ¶
func (s *SignallingServer) Disconnect()
func (*SignallingServer) OnAnswer ¶
func (s *SignallingServer) OnAnswer(f func(answer webrtc.SessionDescription))
func (*SignallingServer) OnError ¶
func (s *SignallingServer) OnError(f func(err error))
func (*SignallingServer) OnIceCandidate ¶
func (s *SignallingServer) OnIceCandidate(f func(candidate webrtc.ICECandidateInit))
func (*SignallingServer) OnOffer ¶
func (s *SignallingServer) OnOffer(f func(offer webrtc.SessionDescription))
func (*SignallingServer) OnPeerConnect ¶
func (s *SignallingServer) OnPeerConnect(f func())
func (*SignallingServer) OnPeerDisconnect ¶
func (s *SignallingServer) OnPeerDisconnect(f func())
func (*SignallingServer) SendAnswer ¶
func (s *SignallingServer) SendAnswer(answer webrtc.SessionDescription)
func (*SignallingServer) SendIceCandidate ¶
func (s *SignallingServer) SendIceCandidate(candidate webrtc.ICECandidateInit)
func (*SignallingServer) SendOffer ¶
func (s *SignallingServer) SendOffer(offer webrtc.SessionDescription)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.