Documentation ¶
Index ¶
- Constants
- Variables
- func FileExist(path string) bool
- func GetArgs(args ...string) (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 string)
- func RandomKey(n int) string
- type Call
- type Client
- type Connector
- type ConnectorConfig
- type DataChannelMsg
- type DataChannelMsgDataSdp
- type JoinConfig
- type MediaType
- type PiControl
- type RTC
- func (r *RTC) Close()
- func (r *RTC) Connect()
- func (r *RTC) Connected() bool
- func (r *RTC) CreateDataChannel(label string) (*webrtc.DataChannel, error)
- func (r *RTC) GetBandWidth(cycle int) (int, int)
- func (r *RTC) GetPubStats() webrtc.StatsReport
- func (r *RTC) GetPubTransport() *Transport
- func (r *RTC) GetSubStats() webrtc.StatsReport
- func (r *RTC) GetSubTransport() *Transport
- func (r *RTC) Name() string
- func (r *RTC) Publish(tracks ...webrtc.TrackLocal) ([]*webrtc.RTPSender, error)
- func (r *RTC) PublishFile(file string, video, audio bool) error
- func (r *RTC) Reconnect()
- func (r *RTC) RegisterNewVideoSource(uid, name string, sourceType rtc.SourceType, config ...*JoinConfig) error
- func (r *RTC) SendAnswer(sdp webrtc.SessionDescription) error
- func (r *RTC) SendAnswer2(sdp webrtc.SessionDescription, to string) error
- func (r *RTC) SendJoin(sid string, uid string, offer webrtc.SessionDescription, ...) error
- func (r *RTC) SendOffer(sdp webrtc.SessionDescription) error
- func (r *RTC) SendTrickle(candidate *webrtc.ICECandidate, target Target)
- func (r *RTC) SendTrickle2(candidate *webrtc.ICECandidate, destination string)
- func (r *RTC) SendWantConnectReply(sdp webrtc.SessionDescription, to string) error
- func (r *RTC) Subscribe(trackInfos []*Subscription) error
- func (r *RTC) SubscribeFromEvent(event TrackEvent, audio, video bool, layer string) error
- func (r *RTC) UnPublish(senders ...*webrtc.RTPSender) error
- type RTCConfig
- type Service
- type ServiceEvent
- type Signaller
- type Subscription
- type Target
- type TrackEvent
- type TrackEvent_State
- type TrackInfo
- type Transport
- type WebMProducer
- func (t *WebMProducer) GetAudioTrack() (*webrtc.TrackLocalStaticSample, error)
- func (t *WebMProducer) GetSendBandwidth(cycle int) int
- func (t *WebMProducer) GetVideoTrack() (*webrtc.TrackLocalStaticSample, error)
- func (t *WebMProducer) Pause(pause bool)
- func (t *WebMProducer) SeekP(ts int)
- func (t *WebMProducer) Start()
- func (t *WebMProducer) Stop()
- type WebRTCTransportConfig
Constants ¶
const ( MimeTypeH264 = "video/H264" MimeTypeOpus = "audio/opus" MimeTypeVP8 = "video/VP8" MimeTypeVP9 = "video/VP9" )
const (
API_CHANNEL = "ion-sfu"
)
Variables ¶
var ( DefaultConfig = RTCConfig{ WebRTC: WebRTCTransportConfig{ Configuration: webrtc.Configuration{ ICEServers: []webrtc.ICEServer{ { URLs: []string{"stun:stun.stunprotocol.org:3478", "stun:stun.l.google.com:19302"}, }, }, }, }, } )
Functions ¶
Types ¶
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 { Id string StartControlTime time.Time StartViewTime time.Time ControlTimer *time.Timer //role Target //Role rtc.Role ConnectType rtclib.ConnectType OnIceConnectionStateChange func(webrtc.ICEConnectionState, *webrtc.PeerConnection) DataChannelEable bool // contains filtered or unexported fields }
Client is pub/sub transport
type Connector ¶
type Connector struct { Metadata metadata.MD OnOpen func(Service) OnClose func(Service, ServiceEvent) // contains filtered or unexported fields }
func NewConnector ¶
func NewConnector(addr string, config ...ConnectorConfig) *Connector
NewConnector create a ion connector
func (*Connector) RegisterService ¶
type ConnectorConfig ¶
type DataChannelMsg ¶
type DataChannelMsg struct { Cmd string `json:"cmd"` //Data string `json:"data"` Data interface{} `json:"data"` }
type DataChannelMsgDataSdp ¶
type JoinConfig ¶
func NewJoinConfig ¶
func NewJoinConfig() *JoinConfig
func SetRelay ¶
func SetRelay(j JoinConfig) *JoinConfig
func (JoinConfig) SetNoAutoSubscribe ¶
func (j JoinConfig) SetNoAutoSubscribe() *JoinConfig
func (JoinConfig) SetNoPublish ¶
func (j JoinConfig) SetNoPublish() *JoinConfig
func (JoinConfig) SetNoSubscribe ¶
func (j JoinConfig) SetNoSubscribe() *JoinConfig
type PiControl ¶
type PiControl struct {
// contains filtered or unexported fields
}
func (*PiControl) DirectionControl ¶
两轮差速控制小车的方向控制
func (*PiControl) SpeedControl ¶
type RTC ¶
type RTC struct { Service MaxTimeControl int MaxTimeView int MaxClientsNum int //controlClient *Client //viewClients map[string]*Client //export to user OnTrack func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) OnDataChannel func(*webrtc.DataChannel) OnError func(error) OnTrackEvent func(event TrackEvent) OnDataChannelMessage func(webrtc.DataChannelMessage) OnSpeaker func(event []string) ControlFunc func(control string, data float64) sync.Mutex OnPubIceConnectionStateChange func(webrtc.ICEConnectionState) OnSubIceConnectionStateChange func(webrtc.ICEConnectionState) OnIceConnectionStateChange func(webrtc.ICEConnectionState, *webrtc.PeerConnection) VedioTrack *webrtc.TrackLocalStaticSample AudioTrack *webrtc.TrackLocalStaticSample // contains filtered or unexported fields }
Client a sdk client
func NewRTCWithSignaller ¶
NewRTCWithSignaller creates an RTC with a specified signaller
func (*RTC) CreateDataChannel ¶
CreateDataChannel create a custom datachannel
func (*RTC) GetBandWidth ¶
GetBandWidth call this api cyclely
func (*RTC) GetPubTransport ¶
func (*RTC) GetSubTransport ¶
func (*RTC) PublishFile ¶
PublishWebm publish a webm producer
func (*RTC) RegisterNewVideoSource ¶
func (r *RTC) RegisterNewVideoSource(uid, name string, sourceType rtc.SourceType, config ...*JoinConfig) error
Creata new session
func (*RTC) SendAnswer ¶
func (*RTC) SendAnswer2 ¶
func (*RTC) SendTrickle ¶
func (*RTC) SendTrickle2 ¶
func (*RTC) SendWantConnectReply ¶
func (*RTC) Subscribe ¶
func (r *RTC) Subscribe(trackInfos []*Subscription) error
Subscribe to tracks
func (*RTC) SubscribeFromEvent ¶
func (r *RTC) SubscribeFromEvent(event TrackEvent, audio, video bool, layer string) error
SubscribeFromEvent will parse event and subscribe what you want
type RTCConfig ¶
type RTCConfig struct {
WebRTC WebRTCTransportConfig `mapstructure:"webrtc"`
}
type ServiceEvent ¶
type Signaller ¶
type Signaller interface { Send(request *rtc.Request) error Recv() (*rtc.Reply, error) CloseSend() error }
Signaller sends and receives signalling messages with peers. Signaller is derived from rtc.RTC_SignalClient, matching the exported API of the GRPC Signal Service. Signaller allows alternative signalling implementations if the GRPC Signal Service does not fit your use case.
type Subscription ¶
type TrackEvent ¶
type TrackEvent struct { State TrackEvent_State Uid string Tracks []*TrackInfo }
TrackEvent info
type TrackEvent_State ¶
type TrackEvent_State int32
const ( TrackEvent_ADD TrackEvent_State = 0 TrackEvent_UPDATE TrackEvent_State = 1 TrackEvent_REMOVE TrackEvent_State = 2 )
type Transport ¶
type Transport struct { SendCandidates []*webrtc.ICECandidate RecvCandidates []webrtc.ICECandidateInit // contains filtered or unexported fields }
Transport is pub/sub transport
func NewTransport ¶
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(name string, offset int) *WebMProducer
NewWebMProducer new a WebMProducer
func (*WebMProducer) GetAudioTrack ¶
func (t *WebMProducer) GetAudioTrack() (*webrtc.TrackLocalStaticSample, error)
GetAudioTrack get audio track
func (*WebMProducer) GetSendBandwidth ¶
func (t *WebMProducer) GetSendBandwidth(cycle int) int
GetSendBandwidth calc the sending bandwidth with cycle(s)
func (*WebMProducer) GetVideoTrack ¶
func (t *WebMProducer) GetVideoTrack() (*webrtc.TrackLocalStaticSample, error)
GetVideoTrack get video track
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()
type WebRTCTransportConfig ¶
type WebRTCTransportConfig struct { // if set, only this codec will be registered. leave unset to register all codecs. VideoMime string Configuration webrtc.Configuration Setting webrtc.SettingEngine }
WebRTCTransportConfig represents configuration options
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
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 |
gstreamer-src
Package gst provides an easy API to create an appsink pipeline
|
Package gst provides an easy API to create an appsink pipeline |