webrtc

package
v0.0.0-...-9402fd8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Configuration: webrtc.Configuration{
		ICEServers: []webrtc.ICEServer{{URLs: []string{"stun:stun.l.google.com:19302"}}},
	},
	VideoCodec: webrtc.MimeTypeH264,
}

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 NewPeerConnection

func NewPeerConnection(conf *Config) (*webrtc.PeerConnection, error)

Types

type Config

type Config struct {
	webrtc.Configuration

	Nat1to1             string
	DisableInterceptors bool
	VideoCodec          string
}

func (*Config) GetStun

func (c *Config) GetStun() string

func (*Config) Override

func (c *Config) Override(options ...Option)

type Option

type Option func(*Config)

func Codec

func Codec(name string) Option

func DisableInterceptors

func DisableInterceptors(disable bool) Option

func Nat1to1

func Nat1to1(natIp string) Option

func StunServer

func StunServer(server string) Option

type WebRTC

type WebRTC struct {
	ID string

	ImageChannel chan *rtp.Packet
	AudioChannel chan *rtp.Packet
	InputChannel chan []byte

	Done bool
	// contains filtered or unexported fields
}

func NewWebRTC

func NewWebRTC() *WebRTC

NewWebRTC create

func (*WebRTC) AddCandidate

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

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(onIceCandidate func(c string), conf *Config) (string, error)

StartClient start webrtc

func (*WebRTC) StopClient

func (w *WebRTC) StopClient()

StopClient disconnect

Jump to

Keyboard shortcuts

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