Documentation ¶
Index ¶
- Constants
- func ValidateVPFile(name string) (string, bool)
- type BizClient
- type Call
- type Client
- func (c *Client) Close()
- func (c *Client) CreateDataChannel(label string) (*webrtc.DataChannel, error)
- func (c *Client) GetPubStats() webrtc.StatsReport
- func (c *Client) GetPubTransport() *Transport
- func (c *Client) GetSubStats() webrtc.StatsReport
- func (c *Client) GetSubTransport() *Transport
- func (c *Client) Join(sid string, config *JoinConfig) error
- func (c *Client) Negotiate(sdp webrtc.SessionDescription) error
- func (c *Client) OnNegotiationNeeded()
- func (c *Client) Publish(track webrtc.TrackLocal) (*webrtc.RTPTransceiver, error)
- func (c *Client) PublishWebm(file string, video, audio bool) error
- func (c *Client) SetRemoteSDP(sdp webrtc.SessionDescription) error
- func (c *Client) Simulcast(layer string)
- func (c *Client) SubscribeAll(video string, audio bool)
- func (c *Client) Trickle(candidate webrtc.ICECandidateInit, target int)
- func (c *Client) UnPublish(t *webrtc.RTPTransceiver) error
- func (c *Client) UnSubscribeAll()
- type Config
- type Engine
- type IonConnector
- type JoinConfig
- type Message
- type Peer
- type PeerEvent
- type PeerState
- type Signal
- func (s *Signal) Answer(sdp webrtc.SessionDescription)
- func (s *Signal) Close()
- func (s *Signal) Join(sid string, uid string, offer webrtc.SessionDescription, config *JoinConfig) error
- func (s *Signal) Offer(sdp webrtc.SessionDescription)
- func (s *Signal) Trickle(candidate *webrtc.ICECandidate, target int)
- func (s *Signal) TrickleFromInit(candidate webrtc.ICECandidateInit, target int)
- type Stream
- type StreamEvent
- type StreamState
- type Track
- type Transport
- type WebMProducer
- func (t *WebMProducer) AddTrack(pc *webrtc.PeerConnection, kind string) (*webrtc.TrackLocalStaticSample, error)
- func (t *WebMProducer) AudioTrack() *webrtc.TrackLocalStaticSample
- func (t *WebMProducer) GetSendBandwidth(cycle int) int
- func (t *WebMProducer) Pause(pause bool)
- func (t *WebMProducer) SeekP(ts int)
- func (t *WebMProducer) Start()
- func (t *WebMProducer) Stop()
- func (t *WebMProducer) VideoCodec() string
- func (t *WebMProducer) VideoTrack() *webrtc.TrackLocalStaticSample
- type WebRTCTransportConfig
Constants ¶
const ( API_CHANNEL = "ion-sfu" PUBLISHER = 0 SUBSCRIBER = 1 )
Variables ¶
This section is empty.
Functions ¶
func ValidateVPFile ¶
Types ¶
type BizClient ¶
type BizClient struct { sync.Mutex OnJoin func(success bool, reason string) OnLeave func(reason string) OnPeerEvent func(state PeerState, peer Peer) OnStreamEvent func(state StreamState, sid string, uid string, streams []*Stream) OnMessage func(from string, to string, data map[string]interface{}) OnError func(error) // contains filtered or unexported fields }
func NewBizClient ¶
type Call ¶
type Call struct { StreamID string `json:"streamId"` Video string `json:"video"` Audio bool `json:"audio"` }
Call dc api
type Client ¶
type Client struct { //export to user OnTrack func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) OnDataChannel func(*webrtc.DataChannel) OnError func(error) // contains filtered or unexported fields }
Client a sdk client
func (*Client) CreateDataChannel ¶
CreateDataChannel create a custom datachannel
func (*Client) GetPubStats ¶
func (c *Client) GetPubStats() webrtc.StatsReport
GetPubStats get pub stats
func (*Client) GetPubTransport ¶
func (*Client) GetSubStats ¶
func (c *Client) GetSubStats() webrtc.StatsReport
GetSubStats get sub stats
func (*Client) GetSubTransport ¶
func (*Client) Join ¶
func (c *Client) Join(sid string, config *JoinConfig) error
Join client join a session
func (*Client) OnNegotiationNeeded ¶
func (c *Client) OnNegotiationNeeded()
OnNegotiationNeeded will be called when add/remove track, but never trigger, call by hand
func (*Client) PublishWebm ¶
PublishWebm publish a webm producer
func (*Client) SetRemoteSDP ¶
SetRemoteSDP pub SetRemoteDescription and send cadidate to sfu
func (*Client) SubscribeAll ¶
SubscribeAll subscribe all stream with the same video/audio param
func (*Client) UnSubscribeAll ¶
func (c *Client) UnSubscribeAll()
UnSubscribeAll unsubscribe all stream
type Config ¶
type Config struct { // WebRTC WebRTCConf `mapstructure:"webrtc"` WebRTC WebRTCTransportConfig `mapstructure:"webrtc"` }
Config ..
type Engine ¶
Engine a sdk engine
type IonConnector ¶
type IonConnector struct { OnJoin func(success bool, reason string) OnLeave func(reason string) OnTrack func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) OnDataChannel func(dc *webrtc.DataChannel) OnPeerEvent func(event PeerEvent) OnStreamEvent func(event StreamEvent) OnMessage func(msg Message) OnError func(error) // contains filtered or unexported fields }
func NewIonConnector ¶
func NewIonConnector(addr string, uid string, pinfo map[string]interface{}) *IonConnector
func (*IonConnector) Close ¶
func (i *IonConnector) Close()
func (*IonConnector) Join ¶
func (i *IonConnector) Join(sid string) error
func (*IonConnector) Leave ¶
func (i *IonConnector) Leave(uid string) error
func (*IonConnector) Message ¶
func (i *IonConnector) Message(from string, to string, data map[string]interface{})
func (*IonConnector) SFU ¶
func (i *IonConnector) SFU() *Client
type JoinConfig ¶
func NewJoinConfig ¶
func NewJoinConfig() *JoinConfig
func SetRelay ¶
func SetRelay(j JoinConfig) *JoinConfig
func (JoinConfig) SetNoPublish ¶
func (j JoinConfig) SetNoPublish() *JoinConfig
func (JoinConfig) SetNoSubscribe ¶
func (j JoinConfig) SetNoSubscribe() *JoinConfig
type Signal ¶
type Signal struct { OnNegotiate func(webrtc.SessionDescription) error OnTrickle func(candidate webrtc.ICECandidateInit, target int) OnSetRemoteSDP func(webrtc.SessionDescription) error OnError func(error) sync.Mutex // contains filtered or unexported fields }
Signal is a wrapper of grpc
func (*Signal) Join ¶
func (s *Signal) Join(sid string, uid string, offer webrtc.SessionDescription, config *JoinConfig) error
func (*Signal) TrickleFromInit ¶
type StreamEvent ¶
type StreamEvent struct { State StreamState Sid string Uid string Streams []*Stream }
type StreamState ¶
type StreamState int32
const ( StreamADD StreamState = 0 StreamREMOVE StreamState = 2 )
type Transport ¶
type Transport struct { SendCandidates []*webrtc.ICECandidate RecvCandidates []webrtc.ICECandidateInit // contains filtered or unexported fields }
Transport is pub/sub transport
func NewTransport ¶
func NewTransport(role int, signal *Signal, cfg WebRTCTransportConfig) *Transport
NewTransport create a transport
func (*Transport) GetPeerConnection ¶
func (t *Transport) GetPeerConnection() *webrtc.PeerConnection
type WebMProducer ¶
type WebMProducer struct {
// contains filtered or unexported fields
}
WebMProducer support streaming by webm which encode with vp8 and opus
func NewWebMProducer ¶
func NewWebMProducer(id, name string, offset int) *WebMProducer
NewWebMProducer new a WebMProducer
func (*WebMProducer) AddTrack ¶
func (t *WebMProducer) AddTrack(pc *webrtc.PeerConnection, kind string) (*webrtc.TrackLocalStaticSample, error)
AddTrack will add new track to pc
func (*WebMProducer) AudioTrack ¶
func (t *WebMProducer) AudioTrack() *webrtc.TrackLocalStaticSample
func (*WebMProducer) GetSendBandwidth ¶
func (t *WebMProducer) GetSendBandwidth(cycle int) int
GetSendBandwidth calc the sending bandwidth with cycle(s)
func (*WebMProducer) Pause ¶
func (t *WebMProducer) Pause(pause bool)
func (*WebMProducer) SeekP ¶
func (t *WebMProducer) SeekP(ts int)
func (*WebMProducer) Start ¶
func (t *WebMProducer) Start()
func (*WebMProducer) Stop ¶
func (t *WebMProducer) Stop()
func (*WebMProducer) VideoCodec ¶
func (t *WebMProducer) VideoCodec() string
func (*WebMProducer) VideoTrack ¶
func (t *WebMProducer) VideoTrack() *webrtc.TrackLocalStaticSample
type WebRTCTransportConfig ¶
type WebRTCTransportConfig struct { VideoMime string Configuration webrtc.Configuration Setting webrtc.SettingEngine }
WebRTCTransportConfig represents configuration options
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
example
|
|
pkg
|
|
gstreamer-sink
Package gst provides an easy API to create an appsrc pipeline
|
Package gst provides an easy API to create an appsrc pipeline |