media

package
v0.0.0-...-b17c507 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	H264FrameDuration = time.Millisecond * 33
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MediaController

type MediaController struct {
	// map of media streams being sent to this relay from the backend or frontend clients (key is the track name)
	MediaSources   map[string]MediaSource
	DevicesWrapper *mediaDevicesWrapper
	MediaEngine    webrtc.MediaEngine
}

func NewMediaController

func NewMediaController() *MediaController

func (*MediaController) AddRtpTrack

func (mediaCtrl *MediaController) AddRtpTrack(trackName string, kind string, rtpSrcUrl string, codecParams webrtc.RTPCodecParameters) (*RtpMediaSource, error)

AddRtpTrack: add a new rtp track to the media controller and start listening for incoming rtp packets

func (*MediaController) GetCallConnectionOptions

func (mediaCtrl *MediaController) GetCallConnectionOptions() *peerjs.ConnectionOptions

func (*MediaController) GetTrack

func (mediaCtrl *MediaController) GetTrack(trackName string) MediaSource

func (*MediaController) RemoveTrack

func (mediaCtrl *MediaController) RemoveTrack(trackName string, closeTrack bool) (error, MediaSource)

close the media source and remove it from the map

type MediaSource

type MediaSource interface {
	GetTrack() *webrtc.TrackLocalStaticRTP // the webrtc track to hold the media .TrackLocal
	StartMediaStream()
	AddConsumer(peerId string)
	RemoveConsumer(peerId string)
	GetConsumerPeerIds() []string
	Close()
}

type RtpMediaSource

type RtpMediaSource struct {
	MediaSource
	// contains filtered or unexported fields
}

func NewRtpMediaSource

func NewRtpMediaSource(url string, readBufferSize int, readInterval time.Duration, mediaMimeType string, trackName string) (*RtpMediaSource, error)

func (*RtpMediaSource) AddConsumer

func (rtpSrc *RtpMediaSource) AddConsumer(peerId string)

func (*RtpMediaSource) Close

func (rtpSrc *RtpMediaSource) Close()

func (*RtpMediaSource) GetConsumerPeerIds

func (rtpSrc *RtpMediaSource) GetConsumerPeerIds() []string

func (*RtpMediaSource) GetTrack

func (rtpSrc *RtpMediaSource) GetTrack() *webrtc.TrackLocalStaticRTP

func (*RtpMediaSource) RemoveConsumer

func (rtpSrc *RtpMediaSource) RemoveConsumer(peerId string)

func (*RtpMediaSource) StartMediaStream

func (rtpSrc *RtpMediaSource) StartMediaStream()

StartMediaStream (blocking) starts pulling packets from the rtp media stream and sending them to the webrtc track

Jump to

Keyboard shortcuts

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