Documentation
¶
Index ¶
- Constants
- func ValidateVPFile(name string) (string, bool)
- type Call
- type Candidate
- type Client
- func (c *Client) AddTrack(track webrtc.TrackLocal) (*webrtc.RTPSender, error)
- func (c *Client) Close()
- func (c *Client) CreateDataChannel(label string) (*webrtc.DataChannel, error)
- func (c *Client) CreateMediaEngine(track webrtc.TrackLocal) (*webrtc.RTPSender, 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) 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 Response
- type ResponseCandidate
- type SendAnswer
- type SendOffer
- type Signal
- type Transport
- type TrickleResponse
- 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 Call ¶
type Call struct { StreamID string `json:"streamId"` Video string `json:"video"` Audio bool `json:"audio"` }
Call dc api
type Candidate ¶
type Candidate struct { Target int `json:"target"` Candidate *webrtc.ICECandidate `json:candidate` }
dir /x查看短路径
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 NewClientByPubMedia ¶
func NewClientByPubMedia(engine *Engine, addr string, cid string, me *webrtc.MediaEngine) (*Client, error)
NewClient create a sdk client
func (*Client) CreateDataChannel ¶
CreateDataChannel create a custom datachannel
func (*Client) CreateMediaEngine ¶
Add a local track
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) 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 { Log log.MyLogger `mapstructure:"log"` // WebRTC WebRTCConf `mapstructure:"webrtc"` WebRTC WebRTCTransportConfig `mapstructure:"webrtc"` }
Config ..
type Engine ¶
Engine a sdk engine
type Response ¶
type Response struct { Params *webrtc.SessionDescription `json:params` Result *webrtc.SessionDescription `json:result` Sparam string `json:sparam` Method string `json:method` Id uint64 `json:id` }
Response received from the sfu over Websockets
type ResponseCandidate ¶
type ResponseCandidate struct { Target int `json:"target"` Candidate *webrtc.ICECandidateInit `json:candidate` }
type SendAnswer ¶
type SendAnswer struct { SID string `json:sid` Answer *webrtc.SessionDescription `json:answer` }
SendAnswer object to send to the sfu over Websockets
type SendOffer ¶
type SendOffer struct { SID string `json:sid` Offer *webrtc.SessionDescription `json:offer` }
SendOffer object to send to the sfu over Websockets
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
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 NewTransportByMedia ¶
func NewTransportByMedia(role int, signal *Signal, cfg WebRTCTransportConfig, me *webrtc.MediaEngine) *Transport
NewTransport create a transport
func (*Transport) GetPeerConnection ¶
func (t *Transport) GetPeerConnection() *webrtc.PeerConnection
type TrickleResponse ¶
type TrickleResponse struct { Params ResponseCandidate `json:params` Method string `json:method` }
TrickleResponse received from the sfu server
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