webrtc

package
v1.9.6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 20 Imported by: 0

README

StateChange

  1. offer = pc.CreateOffer()
  2. pc.SetLocalDescription(offer)
  3. OnICEGatheringStateChange: gathering
  4. OnSignalingStateChange: have-local-offer *. OnICEGatheringStateChange: complete
  5. pc.SetRemoteDescription(answer)
  6. OnSignalingStateChange: stable
  7. OnICEConnectionStateChange: checking
  8. OnICEConnectionStateChange: connected

Documentation

Index

Constants

View Source
const PriorityHostTCPPassive uint32 = 0x001F_FFFF |
	99<<24 |

	4<<21 // tcp passive
View Source
const PriorityHostUDP uint32 = 0x001F_FFFF |
	126<<24 |

	7<<21 // udp
View Source
const ReceiveMTU = 1472

ReceiveMTU = Ethernet MTU (1500) - IP Header (20) - UDP Header (8) https://ffmpeg.org/ffmpeg-all.html#Muxer

Variables

This section is empty.

Functions

func CandidateHostPriority added in v1.9.2

func CandidateHostPriority(network string, index int) uint32

CandidateHostPriority (lower indexes has a higher priority)

func CandidateICE added in v1.9.2

func CandidateICE(network, host, port string, priority uint32) string

func GetCachedPublicIP

func GetCachedPublicIP() (net.IP, error)

func GetPublicIP

func GetPublicIP() (net.IP, error)

GetPublicIP example from https://github.com/pion/stun

func IsIP

func IsIP(host string) bool

func LookupIP

func LookupIP(address string) (string, error)

func MimeType

func MimeType(codec *core.Codec) string

func NewAPI

func NewAPI() (*webrtc.API, error)

func NewCandidate

func NewCandidate(network, address string) (string, error)

func NewServerAPI added in v1.8.2

func NewServerAPI(network, address string, filters *Filters) (*webrtc.API, error)

func RegisterDefaultCodecs

func RegisterDefaultCodecs(m *webrtc.MediaEngine) error

func SkipNonMediaCodecs added in v1.9.1

func SkipNonMediaCodecs(input []*core.Codec) (output []*core.Codec)

func UnmarshalICEServers added in v1.6.1

func UnmarshalICEServers(b []byte) ([]webrtc.ICEServer, error)

func UnmarshalMedias added in v1.3.0

func UnmarshalMedias(descriptions []*sdp.MediaDescription) (medias []*core.Media)

func WithResampling added in v1.4.0

func WithResampling(medias []*core.Media) []*core.Media

WithResampling - will add for consumer: PCMA/0, PCMU/0, PCM/0, PCML/0 so it can add resampling for PCMA/PCMU and repack for PCM/PCML

Types

type Conn

type Conn struct {
	core.Connection
	core.Listener

	Mode core.Mode `json:"mode"`
	// contains filtered or unexported fields
}

func NewConn added in v1.3.0

func NewConn(pc *webrtc.PeerConnection) *Conn

func (*Conn) AddCandidate

func (c *Conn) AddCandidate(candidate string) error

func (*Conn) AddTrack

func (c *Conn) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiver) error

func (*Conn) Close added in v1.3.0

func (c *Conn) Close() error

func (*Conn) CreateCompleteOffer added in v1.3.0

func (c *Conn) CreateCompleteOffer(medias []*core.Media) (string, error)

func (*Conn) CreateOffer added in v1.3.0

func (c *Conn) CreateOffer(medias []*core.Media) (string, error)

func (*Conn) GetAnswer

func (c *Conn) GetAnswer() (answer string, err error)

func (*Conn) GetCompleteAnswer

func (c *Conn) GetCompleteAnswer(candidates []string, filter func(*webrtc.ICECandidate) bool) (string, error)

GetCompleteAnswer - get SDP answer with candidates inside

func (*Conn) GetMedias

func (c *Conn) GetMedias() []*core.Media

func (*Conn) GetTrack added in v1.3.0

func (c *Conn) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, error)

func (*Conn) MarshalJSON

func (c *Conn) MarshalJSON() ([]byte, error)

func (*Conn) SetAnswer added in v1.3.0

func (c *Conn) SetAnswer(answer string) (err error)

func (*Conn) SetOffer

func (c *Conn) SetOffer(offer string) (err error)

func (*Conn) Start added in v1.3.0

func (c *Conn) Start() error

type Filters added in v1.9.2

type Filters struct {
	Candidates []string `yaml:"candidates"`
	Interfaces []string `yaml:"interfaces"`
	IPs        []string `yaml:"ips"`
	Networks   []string `yaml:"networks"`
	UDPPorts   []uint16 `yaml:"udp_ports"`
}

type Track added in v1.3.0

type Track struct {
	// contains filtered or unexported fields
}

func NewTrack added in v1.3.0

func NewTrack(kind string) *Track

func (*Track) Bind added in v1.3.0

func (t *Track) Bind(context webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)

func (*Track) ID added in v1.3.0

func (t *Track) ID() string

func (*Track) Kind added in v1.3.0

func (t *Track) Kind() webrtc.RTPCodecType

func (*Track) RID added in v1.3.0

func (t *Track) RID() string

func (*Track) StreamID added in v1.3.0

func (t *Track) StreamID() string

func (*Track) Unbind added in v1.3.0

func (t *Track) Unbind(context webrtc.TrackLocalContext) error

func (*Track) WriteRTP added in v1.3.0

func (t *Track) WriteRTP(payloadType uint8, packet *rtp.Packet) (err error)

Jump to

Keyboard shortcuts

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