Documentation
¶
Overview ¶
Package ayame は Ayame クライアントライブラリです。
Index ¶
- func SetLogger(l *log.Logger)
- type Connection
- func (c *Connection) Connect() error
- func (c *Connection) CreateDataChannel(label string, options *webrtc.DataChannelInit) (*webrtc.DataChannel, error)
- func (c *Connection) Disconnect()
- func (c *Connection) OnBye(f func())
- func (c *Connection) OnConnect(f func())
- func (c *Connection) OnDataChannel(f func(dc *webrtc.DataChannel))
- func (c *Connection) OnDisconnect(f func(reason string, err error))
- func (c *Connection) OnOpen(f func(metadata *interface{}))
- func (c *Connection) OnTrackPacket(f func(track *webrtc.Track, packet *rtp.Packet))
- type ConnectionAudioOption
- type ConnectionOptions
- type ConnectionVideoOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connection ¶
type Connection struct {
// シグナリングに利用する URL
SignalingURL string
// Ayame のルームID
RoomID string
// Ayame の接続オプション
Options *ConnectionOptions
// デバッグログの出力の可否
Debug bool
// 送信する認証用のメタデータ
AuthnMetadata *interface{}
// contains filtered or unexported fields
}
Connection は PeerConnection 接続を管理します。
func NewConnection ¶
func NewConnection(signalingURL string, roomID string, options *ConnectionOptions, debug bool, isRelay bool) *Connection
NewConnection は Ayame Connection を生成して返します。
func (*Connection) Connect ¶
func (c *Connection) Connect() error
Connect は PeerConnection 接続を開始します。
func (*Connection) CreateDataChannel ¶ added in v0.2.0
func (c *Connection) CreateDataChannel(label string, options *webrtc.DataChannelInit) (*webrtc.DataChannel, error)
CreateDataChannel は指定した label と options から新しい DataChannel 作成して、追加します。
func (*Connection) Disconnect ¶
func (c *Connection) Disconnect()
Disconnect は PeerConnection 接続を切断します。
func (*Connection) OnConnect ¶
func (c *Connection) OnConnect(f func())
OnConnect は connect イベント発生時のコールバック関数を設定します。
func (*Connection) OnDataChannel ¶ added in v0.2.0
func (c *Connection) OnDataChannel(f func(dc *webrtc.DataChannel))
OnDataChannel は datachannel イベント発生時のコールバック関数を設定します。
func (*Connection) OnDisconnect ¶
func (c *Connection) OnDisconnect(f func(reason string, err error))
OnDisconnect は disconnect イベント発生時のコールバック関数を設定します。
func (*Connection) OnOpen ¶
func (c *Connection) OnOpen(f func(metadata *interface{}))
OnOpen は open イベント発生時のコールバック関数を設定します。
func (*Connection) OnTrackPacket ¶
func (c *Connection) OnTrackPacket(f func(track *webrtc.Track, packet *rtp.Packet))
OnTrackPacket は RTP Packet 受診時に発生するコールバック関数を設定します。
type ConnectionAudioOption ¶
type ConnectionAudioOption struct {
// 送受信方向。現在、'recvonly' のみサポート
Direction webrtc.RTPTransceiverDirection
// 有効かどうかのフラグ
Enabled bool
// 対応しているコーデックの設定
Codecs []*webrtc.RTPCodec
}
ConnectionAudioOption は Audio に関数するオプションです。
type ConnectionOptions ¶
type ConnectionOptions struct {
// Audio の設定
Audio ConnectionAudioOption
// Video の設定
Video ConnectionVideoOption
// クライアントID
ClientID string
// Ayame から ICEServer 情報が返って来なかった場合に使われる ICEServer の情報
ICEServers []webrtc.ICEServer
// 認証が必要なルームへの接続時に必要なシグナリングキー
SignalingKey string
// TrickleICE を利用するかどうかのフラグ
UseTrickeICE bool
}
ConnectionOptions は Ayame 接続オプションです。
func DefaultOptions ¶
func DefaultOptions() *ConnectionOptions
DefaultOptions は Ayame 接続オプションのデフォルト値を生成して返します。
type ConnectionVideoOption ¶
type ConnectionVideoOption struct {
// 送受信方向。現在、'recvonly' のみサポート
Direction webrtc.RTPTransceiverDirection
// 有効かどうかのフラグ
Enabled bool
// 対応しているコーデックの設定
Codecs []*webrtc.RTPCodec
}
ConnectionVideoOption は Video に関するオプションです。