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 GetError(err *room.Error) error
- func RandomKey(n int) string
- type Call
- type Connector
- type ConnectorConfig
- type JoinConfig
- type JoinInfo
- type MediaType
- type PeerInfo
- type PeerState
- type Peer_Direction
- type Protocol
- 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) Join(sid, uid string, config ...*JoinConfig) error
- func (r *RTC) Name() string
- func (r *RTC) Publish(tracks ...webrtc.TrackLocal) ([]*webrtc.RTPTransceiver, error)
- func (r *RTC) PublishFile(file string, video, audio bool) error
- func (r *RTC) SendAnswer(sdp webrtc.SessionDescription) 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) Subscribe(trackInfos []*Subscription) error
- func (r *RTC) SubscribeFromEvent(event TrackEvent, audio, video bool, layer string) error
- func (r *RTC) UnPublish(transceivers ...*webrtc.RTPTransceiver) error
- type RTCConfig
- type Role
- type Room
- func (r *Room) AddPeer(peer PeerInfo) error
- func (c *Room) Close()
- func (c *Room) Connect()
- func (c *Room) Connected() bool
- func (r *Room) CreateRoom(info RoomInfo) error
- func (r *Room) EndRoom(sid, reason string, delete bool) error
- func (r *Room) GetPeers(sid string) []PeerInfo
- func (c *Room) Join(j JoinInfo) error
- func (c *Room) Leave(sid, uid string) error
- func (c *Room) Name() string
- func (r *Room) RemovePeer(sid, uid string) error
- func (c *Room) SendMessage(sid, from, to string, data map[string]interface{}) error
- func (r *Room) UpdatePeer(peer PeerInfo) error
- func (r *Room) UpdateRoom(info RoomInfo) error
- type RoomInfo
- type Service
- type ServiceEvent
- 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 ¶ added in v0.2.0
type Call struct {
StreamID string `json:"streamId"`
Video string `json:"video"`
Audio bool `json:"audio"`
}
Call dc api
type Connector ¶ added in v0.7.0
type Connector struct {
Metadata metadata.MD
OnOpen func(Service)
OnClose func(Service, ServiceEvent)
// contains filtered or unexported fields
}
func NewConnector ¶ added in v0.7.0
func NewConnector(addr string, config ...ConnectorConfig) *Connector
NewConnector create a ion connector
func (*Connector) RegisterService ¶ added in v0.7.0
type ConnectorConfig ¶ added in v0.7.0
type JoinConfig ¶ added in v0.6.0
func NewJoinConfig ¶ added in v0.6.0
func NewJoinConfig() *JoinConfig
func SetRelay ¶ added in v0.6.0
func SetRelay(j JoinConfig) *JoinConfig
func (JoinConfig) SetNoAutoSubscribe ¶ added in v0.7.0
func (j JoinConfig) SetNoAutoSubscribe() *JoinConfig
func (JoinConfig) SetNoPublish ¶ added in v0.6.0
func (j JoinConfig) SetNoPublish() *JoinConfig
func (JoinConfig) SetNoSubscribe ¶ added in v0.6.0
func (j JoinConfig) SetNoSubscribe() *JoinConfig
type Peer_Direction ¶ added in v0.7.0
type Peer_Direction int32
const ( Peer_INCOMING Peer_Direction = 0 Peer_OUTGOING Peer_Direction = 1 Peer_BILATERAL Peer_Direction = 2 )
type RTC ¶ added in v0.7.0
type RTC struct {
Service
//export to user
OnTrack func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver)
OnDataChannel func(*webrtc.DataChannel)
OnError func(error)
OnTrackEvent func(event TrackEvent)
OnSpeaker func(event []string)
sync.Mutex
// contains filtered or unexported fields
}
Client a sdk client
func (*RTC) CreateDataChannel ¶ added in v0.7.0
func (r *RTC) CreateDataChannel(label string) (*webrtc.DataChannel, error)
CreateDataChannel create a custom datachannel
func (*RTC) GetBandWidth ¶ added in v0.7.0
GetBandWidth call this api cyclely
func (*RTC) GetPubStats ¶ added in v0.7.0
func (r *RTC) GetPubStats() webrtc.StatsReport
GetPubStats get pub stats
func (*RTC) GetPubTransport ¶ added in v0.7.0
func (*RTC) GetSubStats ¶ added in v0.7.0
func (r *RTC) GetSubStats() webrtc.StatsReport
GetSubStats get sub stats
func (*RTC) GetSubTransport ¶ added in v0.7.0
func (*RTC) Join ¶ added in v0.7.0
func (r *RTC) Join(sid, uid string, config ...*JoinConfig) error
Join client join a session
func (*RTC) Publish ¶ added in v0.7.0
func (r *RTC) Publish(tracks ...webrtc.TrackLocal) ([]*webrtc.RTPTransceiver, error)
Publish local tracks
func (*RTC) PublishFile ¶ added in v0.7.0
PublishWebm publish a webm producer
func (*RTC) SendAnswer ¶ added in v0.7.0
func (r *RTC) SendAnswer(sdp webrtc.SessionDescription) error
func (*RTC) SendOffer ¶ added in v0.7.0
func (r *RTC) SendOffer(sdp webrtc.SessionDescription) error
func (*RTC) SendTrickle ¶ added in v0.7.0
func (r *RTC) SendTrickle(candidate *webrtc.ICECandidate, target Target)
func (*RTC) Subscribe ¶ added in v0.7.0
func (r *RTC) Subscribe(trackInfos []*Subscription) error
Subscribe to tracks
func (*RTC) SubscribeFromEvent ¶ added in v0.7.0
func (r *RTC) SubscribeFromEvent(event TrackEvent, audio, video bool, layer string) error
SubscribeFromEvent will parse event and subscribe what you want
type RTCConfig ¶ added in v0.7.0
type RTCConfig struct {
WebRTC WebRTCTransportConfig `mapstructure:"webrtc"`
}
type Room ¶ added in v0.7.0
type Room struct {
Service
sync.Mutex
OnJoin func(success bool, info RoomInfo, err error)
OnLeave func(success bool, err error)
OnPeerEvent func(state PeerState, Peer PeerInfo)
OnMessage func(from string, to string, data map[string]interface{})
OnDisconnect func(sid, reason string)
OnRoomInfo func(info RoomInfo)
OnError func(error)
// contains filtered or unexported fields
}
func (*Room) CreateRoom ¶ added in v0.7.0
CreateRoom Params: sid password, at lease a sid
func (*Room) RemovePeer ¶ added in v0.7.0
func (*Room) SendMessage ¶ added in v0.7.0
SendMessage send message from is a uid to is a uid or "all"
func (*Room) UpdatePeer ¶ added in v0.7.0
func (*Room) UpdateRoom ¶ added in v0.7.0
type ServiceEvent ¶ added in v0.7.0
type Subscription ¶ added in v0.7.0
type TrackEvent ¶ added in v0.7.0
type TrackEvent struct {
State TrackEvent_State
Uid string
Tracks []*TrackInfo
}
TrackEvent info
type TrackEvent_State ¶ added in v0.7.0
type TrackEvent_State int32
const ( TrackEvent_ADD TrackEvent_State = 0 TrackEvent_UPDATE TrackEvent_State = 1 TrackEvent_REMOVE TrackEvent_State = 2 )
type Transport ¶ added in v0.2.0
type Transport struct {
SendCandidates []*webrtc.ICECandidate
RecvCandidates []webrtc.ICECandidateInit
// contains filtered or unexported fields
}
Transport is pub/sub transport
func NewTransport ¶ added in v0.2.0
NewTransport create a transport
func (*Transport) GetPeerConnection ¶ added in v0.4.5
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 ¶ added in v0.7.0
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 ¶ added in v0.7.0
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 {
VideoMime string
Configuration webrtc.Configuration
Setting webrtc.SettingEngine
}
WebRTCTransportConfig represents configuration options
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
ion-cluster-simple
command
|
|
|
ion-sfu-gstreamer-receive
command
|
|
|
ion-sfu-gstreamer-send
command
|
|
|
ion-sfu-join-from-mediadevice
command
|
|
|
ion-sfu-load-tool
command
|
|
|
ion-sfu-save-to-disk
command
|
|
|
ion-sfu-save-to-webm
command
|
|
|
ion-sfu-simple
command
|
|
|
ion-sfu-track-to-rtp
command
|
|
|
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 |