Documentation ¶
Index ¶
- Variables
- func EndpointWithDataChannel(f func(dc *webrtc.DataChannel)) func(endpoint *Endpoint)
- func EndpointWithGetCurrentTrackCbk(ckk func(ctx context.Context, sessionId uuid.UUID) ([]*TrackInfo, error)) func(endpoint *Endpoint)
- func EndpointWithLostConnectionListener(f func()) func(endpoint *Endpoint)
- func EndpointWithNegotiationNeededListener(f func(sdp webrtc.SessionDescription)) func(endpoint *Endpoint)
- func EndpointWithONNSetupTrigger(waitBeforeONNSetup <-chan struct{}) func(endpoint *Endpoint)
- func EndpointWithOnEstablishedListener(onEstablished func()) func(endpoint *Endpoint)
- func EndpointWithTrack(track webrtc.TrackLocal, purpose Purpose) func(endpoint *Endpoint)
- func EndpointWithTrackDispatcher(dispatcher TrackDispatcher) func(endpoint *Endpoint)
- func EndpointWithonIceStateConnectedListener(onIceStateConnected func()) func(endpoint *Endpoint)
- func MarkStreamAsMain(sdpOrigin *webrtc.SessionDescription, streamID string) (*webrtc.SessionDescription, error)
- func ValidateRtpConfig(config *RtpConfig) error
- type Connection
- type Endpoint
- func EstablishEgressEndpoint(sessionCxt context.Context, e *Engine, sessionId uuid.UUID, ...) (*Endpoint, error)
- func EstablishEndpoint(ctx context.Context, sessionCxt context.Context, e *Engine, ...) (*Endpoint, error)
- func EstablishIngressEndpoint(sessionCxt context.Context, e *Engine, sessionId uuid.UUID, ...) (*Endpoint, error)
- func EstablishStaticEgressEndpoint(ctx context.Context, e *Engine, sessionId uuid.UUID, liveStream uuid.UUID, ...) (*Endpoint, error)
- func EstablishStaticIngressEndpoint(ctx context.Context, e *Engine, sendingTracks []webrtc.TrackLocal, ...) (*Endpoint, error)
- func NewMockConnection(ops MockConnectionOps) *Endpoint
- func (c *Endpoint) AddTrack(ctx context.Context, info *TrackInfo)
- func (c *Endpoint) Destruct() error
- func (c *Endpoint) GetLocalDescription(ctx context.Context) (*webrtc.SessionDescription, error)
- func (c *Endpoint) IsInitComplete() bool
- func (c *Endpoint) RemoveTrack(ctx context.Context, info *TrackInfo)
- func (c *Endpoint) SetAnswer(sdp *webrtc.SessionDescription) error
- func (c *Endpoint) SetEgressMute(infoId uuid.UUID, mute bool) (*TrackInfo, bool)
- func (c *Endpoint) SetIngressMute(ingressMid string, mute bool) (*TrackInfo, bool)
- func (c *Endpoint) SetInitComplete()
- func (c *Endpoint) SetNewOffer(sdp *webrtc.SessionDescription) (*webrtc.SessionDescription, error)
- type EndpointOption
- type EndpointType
- type Engine
- func (e *Engine) EstablishEgressEndpoint(ctx context.Context, sessionId uuid.UUID, liveStream uuid.UUID, ...) (*Endpoint, error)
- func (e *Engine) EstablishEndpoint(ctx context.Context, sessionCtx context.Context, sessionId uuid.UUID, ...) (*Endpoint, error)
- func (e *Engine) EstablishIngressEndpoint(ctx context.Context, sessionId uuid.UUID, liveStream uuid.UUID, ...) (*Endpoint, error)
- func (e *Engine) EstablishStaticEgressEndpoint(ctx context.Context, sessionId uuid.UUID, liveStream uuid.UUID, ...) (*Endpoint, error)
- func (e *Engine) NewReceiverConnection(ctx context.Context, offer webrtc.SessionDescription, ...) (*Connection, error)
- func (e *Engine) NewSignalConnection(ctx context.Context, handler StateEventHandler) (*Connection, error)
- func (e *Engine) NewStaticMediaSenderEndpoint(media *static.MediaFile) (*Endpoint, error)
- func (e *Engine) OfferEndpoint(ctx context.Context, sessionCtx context.Context, sessionId uuid.UUID, ...) (*Endpoint, error)
- type ICEServer
- type LiveStreamSender
- type MockConnectionOps
- type Purpose
- type RtpConfig
- type SimulcastLayer
- type StateEventHandler
- type TrackDispatcher
- type TrackInfo
- func (t *TrackInfo) GetEgressMid() string
- func (t *TrackInfo) GetId() uuid.UUID
- func (t *TrackInfo) GetIngressMid() string
- func (t *TrackInfo) GetMute() bool
- func (t *TrackInfo) GetPurpose() Purpose
- func (t *TrackInfo) GetSessionId() uuid.UUID
- func (t *TrackInfo) GetTrack() *webrtc.TrackLocalStaticRTP
- func (t *TrackInfo) GetTrackLocal() webrtc.TrackLocal
- func (t *TrackInfo) SetMute(mute bool)
- type TrackSdpInfo
- type UdpConnection
- type UdpShare
- type UdpShareInfo
- type VideoQuality
Constants ¶
This section is empty.
Variables ¶
var ( VideoQuality_name = map[int32]string{ 0: "LOW", 1: "MEDIUM", 2: "HIGH", 3: "OFF", } VideoQuality_value = map[string]int32{ "LOW": 0, "MEDIUM": 1, "HIGH": 2, "OFF": 3, } )
Enum value maps for VideoQuality.
var ErrIceGatheringInterruption = errors.New("getting ice gathering interrupted")
var ErrSessionClosed = errors.New("process interrupted because session closed")
Functions ¶
func EndpointWithDataChannel ¶
func EndpointWithDataChannel(f func(dc *webrtc.DataChannel)) func(endpoint *Endpoint)
func EndpointWithLostConnectionListener ¶
func EndpointWithLostConnectionListener(f func()) func(endpoint *Endpoint)
func EndpointWithNegotiationNeededListener ¶
func EndpointWithNegotiationNeededListener(f func(sdp webrtc.SessionDescription)) func(endpoint *Endpoint)
func EndpointWithONNSetupTrigger ¶
func EndpointWithONNSetupTrigger(waitBeforeONNSetup <-chan struct{}) func(endpoint *Endpoint)
func EndpointWithOnEstablishedListener ¶
func EndpointWithOnEstablishedListener(onEstablished func()) func(endpoint *Endpoint)
func EndpointWithTrack ¶
func EndpointWithTrackDispatcher ¶
func EndpointWithTrackDispatcher(dispatcher TrackDispatcher) func(endpoint *Endpoint)
func EndpointWithonIceStateConnectedListener ¶
func EndpointWithonIceStateConnectedListener(onIceStateConnected func()) func(endpoint *Endpoint)
func MarkStreamAsMain ¶
func ValidateRtpConfig ¶
Types ¶
type Connection ¶
type Connection struct { PeerConnection *webrtc.PeerConnection GatherComplete <-chan struct{} }
func (*Connection) GetLocalDescription ¶
func (c *Connection) GetLocalDescription(ctx context.Context) (*webrtc.SessionDescription, error)
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func EstablishEgressEndpoint ¶
func EstablishEgressEndpoint(sessionCxt context.Context, e *Engine, sessionId uuid.UUID, liveStream uuid.UUID, options ...EndpointOption) (*Endpoint, error)
EstablishEgressEndpoint Deprecated: Because the Endpoint API is getting simpler
func EstablishEndpoint ¶
func EstablishIngressEndpoint ¶
func EstablishIngressEndpoint(sessionCxt context.Context, e *Engine, sessionId uuid.UUID, liveStream uuid.UUID, offer webrtc.SessionDescription, options ...EndpointOption) (*Endpoint, error)
EstablishIngressEndpoint Deprecated: Because the Endpoint API is getting simpler
func EstablishStaticEgressEndpoint ¶
func EstablishStaticEgressEndpoint(ctx context.Context, e *Engine, sessionId uuid.UUID, liveStream uuid.UUID, offer webrtc.SessionDescription, options ...EndpointOption) (*Endpoint, error)
EstablishStaticEgressEndpoint Deprecated: Because the Endpoint API is getting simpler
func EstablishStaticIngressEndpoint ¶
func EstablishStaticIngressEndpoint(ctx context.Context, e *Engine, sendingTracks []webrtc.TrackLocal, options ...EndpointOption) (*Endpoint, error)
EstablishStaticIngressEndpoint This is used from cmd line toll to start a webrtc connection in a running lobby Deprecated: Because the Endpoint API is getting simpler
func NewMockConnection ¶
func NewMockConnection(ops MockConnectionOps) *Endpoint
func (*Endpoint) GetLocalDescription ¶
func (*Endpoint) IsInitComplete ¶
func (*Endpoint) SetEgressMute ¶
func (*Endpoint) SetIngressMute ¶
func (*Endpoint) SetInitComplete ¶
func (c *Endpoint) SetInitComplete()
func (*Endpoint) SetNewOffer ¶
type EndpointOption ¶
type EndpointOption func(*Endpoint)
type EndpointType ¶
type EndpointType int
const ( IngressEndpoint EndpointType = iota + 1 EgressEndpoint )
func (EndpointType) ToString ¶
func (et EndpointType) ToString() string
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) EstablishEgressEndpoint ¶
func (e *Engine) EstablishEgressEndpoint(ctx context.Context, sessionId uuid.UUID, liveStream uuid.UUID, options ...EndpointOption) (*Endpoint, error)
EstablishEgressEndpoint Deprecated: Because the Endpoint API is getting simpler
func (*Engine) EstablishEndpoint ¶
func (*Engine) EstablishIngressEndpoint ¶
func (e *Engine) EstablishIngressEndpoint(ctx context.Context, sessionId uuid.UUID, liveStream uuid.UUID, offer webrtc.SessionDescription, options ...EndpointOption) (*Endpoint, error)
EstablishIngressEndpoint Deprecated: Because the Endpoint API is getting simpler
func (*Engine) EstablishStaticEgressEndpoint ¶
func (e *Engine) EstablishStaticEgressEndpoint(ctx context.Context, sessionId uuid.UUID, liveStream uuid.UUID, offer webrtc.SessionDescription, options ...EndpointOption) (*Endpoint, error)
EstablishStaticEgressEndpoint Deprecated: Because the Endpoint API is getting simpler
func (*Engine) NewReceiverConnection ¶
func (e *Engine) NewReceiverConnection(ctx context.Context, offer webrtc.SessionDescription, handler StateEventHandler, rtmpEndpoint string) (*Connection, error)
NewReceiverConnection Deprecated: Because the Endpoint API is getting simpler
func (*Engine) NewSignalConnection ¶
func (e *Engine) NewSignalConnection(ctx context.Context, handler StateEventHandler) (*Connection, error)
NewSignalConnection can be used to listen on lobby events. Deprecated: Because the Endpoint API is getting simpler
func (*Engine) NewStaticMediaSenderEndpoint ¶
NewStaticMediaSenderEndpoint can be used to send static streams from file in a lobby. Deprecated: Because the Endpoint API is getting simpler
func (*Engine) OfferEndpoint ¶
type LiveStreamSender ¶
type LiveStreamSender struct {
// contains filtered or unexported fields
}
func NewLiveStreamSender ¶
func (*LiveStreamSender) AddTrack ¶
func (f *LiveStreamSender) AddTrack(track webrtc.TrackLocal)
func (*LiveStreamSender) GetConnData ¶
func (f *LiveStreamSender) GetConnData() UdpShare
func (*LiveStreamSender) RemoveTrack ¶
func (f *LiveStreamSender) RemoveTrack(_ webrtc.TrackLocal)
func (*LiveStreamSender) Run ¶
func (f *LiveStreamSender) Run()
func (*LiveStreamSender) Stop ¶
func (f *LiveStreamSender) Stop()
type MockConnectionOps ¶
type MockConnectionOps struct { Answer *webrtc.SessionDescription GatherComplete chan struct{} }
type SimulcastLayer ¶
type SimulcastLayer struct { Quality VideoQuality `json:"quality,omitempty"` Width uint32 `json:"width,omitempty"` Height uint32 `json:"height,omitempty"` // target bitrate in bit per second (bps), server will measure actual Bitrate uint32 `json:"bitrate,omitempty"` Ssrc uint32 `json:"ssrc,omitempty"` }
func (*SimulcastLayer) GetBitrate ¶
func (sl *SimulcastLayer) GetBitrate() uint32
func (*SimulcastLayer) GetHeight ¶
func (sl *SimulcastLayer) GetHeight() uint32
func (*SimulcastLayer) GetQuality ¶
func (sl *SimulcastLayer) GetQuality() VideoQuality
func (*SimulcastLayer) GetSsrc ¶
func (sl *SimulcastLayer) GetSsrc() uint32
func (*SimulcastLayer) GetWidth ¶
func (sl *SimulcastLayer) GetWidth() uint32
func (*SimulcastLayer) Reset ¶
func (sl *SimulcastLayer) Reset()
type StateEventHandler ¶
type StateEventHandler interface { OnConnectionStateChange(state webrtc.ICEConnectionState) OnNegotiationNeeded(offer webrtc.SessionDescription) OnChannel(dc *webrtc.DataChannel) }
type TrackDispatcher ¶
type TrackInfo ¶
type TrackInfo struct { TrackSdpInfo Track *webrtc.TrackLocalStaticRTP }
func (*TrackInfo) GetEgressMid ¶
func (*TrackInfo) GetIngressMid ¶
func (*TrackInfo) GetPurpose ¶
func (*TrackInfo) GetSessionId ¶
func (*TrackInfo) GetTrackLocal ¶
func (t *TrackInfo) GetTrackLocal() webrtc.TrackLocal
type TrackSdpInfo ¶
type UdpConnection ¶
type UdpConnection struct {
// contains filtered or unexported fields
}
type UdpShareInfo ¶
type UdpShareInfo struct {}
type VideoQuality ¶
type VideoQuality int32
const ( VideoQuality_LOW VideoQuality = 0 VideoQuality_MEDIUM VideoQuality = 1 VideoQuality_HIGH VideoQuality = 2 VideoQuality_OFF VideoQuality = 3 )
Source Files ¶
- config.go
- connection.go
- endpoint.go
- endpoint_mock.go
- endpoint_option.go
- engine.go
- engine_api.go
- establish_egress_endpoint.go
- establish_endpoint.go
- establish_ingress_endpoint.go
- establish_static_egress_enspoint.go
- establish_static_ingress_endpoint.go
- live_stream_sender.go
- live_stream_writer.go
- media_state_event_handler.go
- media_stream.go
- media_writer.go
- receiver.go
- rtmp.go
- sdp.go
- simulcast_layer.go
- state_event_handler.go
- tracer.go
- track_dispatcher.go
- track_info.go
- track_sdp_info.go
- track_sdp_info_repository.go
- udp_connection.go
- video_quality.go