webrtc

package
v2.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

credit to https://github.com/poi5305/go-yuv2webRTC/blob/master/webrtc/webrtc.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(in string, obj interface{}) error

Decode decodes the input from base64

func Encode

func Encode(obj interface{}) (string, error)

Encode encodes the input in base64

func NewInterceptedPeerConnection added in v2.4.1

func NewInterceptedPeerConnection(conf conf.Webrtc, ics []interceptor.Interceptor, vCodec string) (*PeerConnection, error)

func RegisterCodecs added in v2.5.0

func RegisterCodecs(m *MediaEngine, vCodec string) error

RegisterCodecs registers the default codecs supported by WebRTC.

Types

type GameMeta

type GameMeta struct {
	PlayerIndex int
}

Game Meta

type OnIceCallback

type OnIceCallback func(candidate string)

type WebFrame

type WebFrame struct {
	Data      []byte
	Timestamp uint32
}

type WebRTC

type WebRTC struct {
	ID string

	// for yuvI420 image
	ImageChannel chan WebFrame
	AudioChannel chan []byte
	//VoiceInChannel  chan []byte
	//VoiceOutChannel chan []byte
	InputChannel chan []byte

	Done bool

	RoomID string

	// store thing related to game
	GameMeta GameMeta
	// contains filtered or unexported fields
}

WebRTC connection

func NewWebRTC

func NewWebRTC() *WebRTC

NewWebRTC create

func (*WebRTC) AddCandidate

func (w *WebRTC) AddCandidate(candidate string) error

func (*WebRTC) AttachRoomID

func (w *WebRTC) AttachRoomID(roomID string)

func (*WebRTC) IsConnected

func (w *WebRTC) IsConnected() bool

IsConnected comment

func (*WebRTC) SetRemoteSDP

func (w *WebRTC) SetRemoteSDP(remoteSDP string) error

func (*WebRTC) StartClient

func (w *WebRTC) StartClient(iceCB OnIceCallback) (string, error)

StartClient start webrtc

func (*WebRTC) StopClient

func (w *WebRTC) StopClient()

StopClient disconnect

func (*WebRTC) WithConfig added in v2.4.0

func (w *WebRTC) WithConfig(conf webrtcConfig.Config) *WebRTC

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL