Documentation
¶
Index ¶
- Variables
- func CreateVideoLoopers(resolution string, codecFilter string, simulcast bool) ([]videoLooper, error)
- func ReaderTrackWithFrameDuration(duration time.Duration) func(provider *Reader)
- func ReaderTrackWithMime(mime string) func(provider *Reader)
- func ReaderTrackWithOnWriteComplete(f func()) func(provider *Reader)
- func ReaderTrackWithRTCPHandler(f func(rtcp.Packet)) func(provider *Reader)
- type AudioLooperOpus
- type LocalTrack
- func NewLocalFileLooperTrack(file string, options ...LocalTrackOptions) (*LocalTrack, error)
- func NewLocalFileReaderTrack(file string, options ...ReaderOption) (*LocalTrack, error)
- func NewLocalLooperH264Track(input io.ReadCloser, mime string, spec *videoSpec, ...) (*LocalTrack, error)
- func NewLocalLooperOpusTrack(input io.ReadCloser, mime string, trackOpts ...LocalTrackOptions) (*LocalTrack, error)
- func NewLocalLooperVP8Track(input io.ReadCloser, mime string, spec *videoSpec, ...) (*LocalTrack, error)
- func NewLocalReaderTrack(in io.ReadCloser, mime string, options ...ReaderOption) (*LocalTrack, error)
- func NewLocalTrack(c webrtc.RTPCodecCapability, opts ...LocalTrackOptions) (*LocalTrack, error)
- func (s *LocalTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)
- func (s *LocalTrack) Close() error
- func (s *LocalTrack) Codec() webrtc.RTPCodecCapability
- func (s *LocalTrack) ID() string
- func (s *LocalTrack) IsBound() bool
- func (s *LocalTrack) Kind() webrtc.RTPCodecType
- func (s *LocalTrack) OnBind(f func())
- func (s *LocalTrack) OnUnbind(f func())
- func (s *LocalTrack) RID() string
- func (s *LocalTrack) SetTransceiver(transceiver *webrtc.RTPTransceiver)
- func (s *LocalTrack) StartWrite(provider sampler, onComplete func()) error
- func (s *LocalTrack) StreamID() string
- func (s *LocalTrack) Unbind(t webrtc.TrackLocalContext) error
- func (s *LocalTrack) WriteSample(sample media.Sample, opts *SampleWriteOptions) error
- type LocalTrackOptions
- type Looper
- type Reader
- type ReaderOption
- type SampleWriteOptions
- type VideoLooperH264
- func (l *VideoLooperH264) Close() error
- func (l *VideoLooperH264) Codec() webrtc.RTPCodecCapability
- func (l *VideoLooperH264) NextSample() (media.Sample, error)
- func (l *VideoLooperH264) OnBind() error
- func (l *VideoLooperH264) OnUnbind() error
- func (l *VideoLooperH264) ToLayer(quality rtp.VideoQuality) *rtp.SimulcastLayer
- type VideoLooperVP8
- func (l *VideoLooperVP8) Close() error
- func (l *VideoLooperVP8) Codec() webrtc.RTPCodecCapability
- func (l *VideoLooperVP8) NextSample() (media.Sample, error)
- func (l *VideoLooperVP8) OnBind() error
- func (l *VideoLooperVP8) OnUnbind() error
- func (l *VideoLooperVP8) ToLayer(quality rtp.VideoQuality) *rtp.SimulcastLayer
Constants ¶
This section is empty.
Variables ¶
var ErrCannotDetermineMime = errors.New("cannot determine mime")
var ErrUnsupportedFileType = errors.New("unsupported file type")
Functions ¶
func CreateVideoLoopers ¶
func ReaderTrackWithMime ¶
func ReaderTrackWithOnWriteComplete ¶
func ReaderTrackWithOnWriteComplete(f func()) func(provider *Reader)
Types ¶
type AudioLooperOpus ¶
type AudioLooperOpus struct {
// contains filtered or unexported fields
}
func CreateAudioLooper ¶
func CreateAudioLooper() (*AudioLooperOpus, error)
func NewAudioLooperOpus ¶
func NewAudioLooperOpus(input io.Reader) (*AudioLooperOpus, error)
func (*AudioLooperOpus) Close ¶
func (l *AudioLooperOpus) Close() error
func (*AudioLooperOpus) Codec ¶
func (l *AudioLooperOpus) Codec() webrtc.RTPCodecCapability
func (*AudioLooperOpus) NextSample ¶
func (l *AudioLooperOpus) NextSample() (media.Sample, error)
func (*AudioLooperOpus) OnBind ¶
func (l *AudioLooperOpus) OnBind() error
func (*AudioLooperOpus) OnUnbind ¶
func (l *AudioLooperOpus) OnUnbind() error
type LocalTrack ¶
type LocalTrack struct {
// contains filtered or unexported fields
}
LocalTrack is a local track that simplifies writing samples. It handles timing and publishing of things, so as long as a SampleProvider is provided, the class takes care of publishing tracks at the right frequency This extends webrtc.TrackLocalStaticSample, and adds the ability to write RTP extensions
func NewLocalFileLooperTrack ¶
func NewLocalFileLooperTrack(file string, options ...LocalTrackOptions) (*LocalTrack, error)
func NewLocalFileReaderTrack ¶
func NewLocalFileReaderTrack(file string, options ...ReaderOption) (*LocalTrack, error)
func NewLocalLooperH264Track ¶
func NewLocalLooperH264Track(input io.ReadCloser, mime string, spec *videoSpec, trackOpts ...LocalTrackOptions) (*LocalTrack, error)
func NewLocalLooperOpusTrack ¶
func NewLocalLooperOpusTrack(input io.ReadCloser, mime string, trackOpts ...LocalTrackOptions) (*LocalTrack, error)
func NewLocalLooperVP8Track ¶
func NewLocalLooperVP8Track(input io.ReadCloser, mime string, spec *videoSpec, trackOpts ...LocalTrackOptions) (*LocalTrack, error)
func NewLocalReaderTrack ¶
func NewLocalReaderTrack(in io.ReadCloser, mime string, options ...ReaderOption) (*LocalTrack, error)
NewLocalReaderTrack uses io.ReadCloser interface to adapt to various ingress types - mime: has to be one of webrtc.MimeType... (e.g. webrtc.MimeTypeOpus)
func NewLocalTrack ¶
func NewLocalTrack(c webrtc.RTPCodecCapability, opts ...LocalTrackOptions) (*LocalTrack, error)
func (*LocalTrack) Bind ¶
func (s *LocalTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)
Bind is an interface for TrackLocal, not for external consumption
func (*LocalTrack) Close ¶
func (s *LocalTrack) Close() error
func (*LocalTrack) Codec ¶
func (s *LocalTrack) Codec() webrtc.RTPCodecCapability
Codec gets the Codec of the track
func (*LocalTrack) ID ¶
func (s *LocalTrack) ID() string
ID is the unique identifier for this Track. This should be unique for the stream, but doesn't have to globally unique. A common example would be 'audio' or 'video' and StreamID would be 'desktop' or 'webcam'
func (*LocalTrack) IsBound ¶
func (s *LocalTrack) IsBound() bool
func (*LocalTrack) Kind ¶
func (s *LocalTrack) Kind() webrtc.RTPCodecType
Kind controls if this TrackLocal is audio or video
func (*LocalTrack) OnBind ¶
func (s *LocalTrack) OnBind(f func())
OnBind sets a callback to be called when the track has been negotiated for publishing and bound to a peer connection
func (*LocalTrack) OnUnbind ¶
func (s *LocalTrack) OnUnbind(f func())
OnUnbind sets a callback to be called after the track is removed from a peer connection
func (*LocalTrack) SetTransceiver ¶
func (s *LocalTrack) SetTransceiver(transceiver *webrtc.RTPTransceiver)
func (*LocalTrack) StartWrite ¶
func (s *LocalTrack) StartWrite(provider sampler, onComplete func()) error
func (*LocalTrack) StreamID ¶
func (s *LocalTrack) StreamID() string
StreamID is the group this track belongs too. This must be unique
func (*LocalTrack) Unbind ¶
func (s *LocalTrack) Unbind(t webrtc.TrackLocalContext) error
Unbind is an interface for TrackLocal, not for external consumption
func (*LocalTrack) WriteSample ¶
func (s *LocalTrack) WriteSample(sample media.Sample, opts *SampleWriteOptions) error
type LocalTrackOptions ¶
type LocalTrackOptions func(s *LocalTrack)
func WithRTCPHandler ¶
func WithRTCPHandler(cb func(rtcp.Packet)) LocalTrackOptions
func WithSimulcast ¶
func WithSimulcast(simulcastID string, layer *rtp2.SimulcastLayer) LocalTrackOptions
WithSimulcast marks the current track for simulcasting. In order to use simulcast, simulcastID must be identical across all layers
func WithStreamID ¶
func WithStreamID(streamID string) LocalTrackOptions
type Looper ¶
type Looper interface { Codec() webrtc.RTPCodecCapability // contains filtered or unexported methods }
type Reader ¶
type Reader struct { // Configuration Mime string FrameDuration time.Duration OnWriteComplete func() AudioLevel uint8 // contains filtered or unexported fields }
func (*Reader) CurrentAudioLevel ¶
type ReaderOption ¶
type ReaderOption func(*Reader)
type SampleWriteOptions ¶
type SampleWriteOptions struct {
AudioLevel *uint8
}
type VideoLooperH264 ¶
type VideoLooperH264 struct {
// contains filtered or unexported fields
}
func NewVideoLooperH264 ¶
func NewVideoLooperH264(input io.Reader, spec *videoSpec) (*VideoLooperH264, error)
func (*VideoLooperH264) Close ¶
func (l *VideoLooperH264) Close() error
func (*VideoLooperH264) Codec ¶
func (l *VideoLooperH264) Codec() webrtc.RTPCodecCapability
func (*VideoLooperH264) NextSample ¶
func (l *VideoLooperH264) NextSample() (media.Sample, error)
func (*VideoLooperH264) OnBind ¶
func (l *VideoLooperH264) OnBind() error
func (*VideoLooperH264) OnUnbind ¶
func (l *VideoLooperH264) OnUnbind() error
func (*VideoLooperH264) ToLayer ¶
func (l *VideoLooperH264) ToLayer(quality rtp.VideoQuality) *rtp.SimulcastLayer
type VideoLooperVP8 ¶
type VideoLooperVP8 struct {
// contains filtered or unexported fields
}
func NewVideoLooperVP8 ¶
func NewVideoLooperVP8(input io.Reader, spec *videoSpec) (*VideoLooperVP8, error)
func (*VideoLooperVP8) Close ¶
func (l *VideoLooperVP8) Close() error
func (*VideoLooperVP8) Codec ¶
func (l *VideoLooperVP8) Codec() webrtc.RTPCodecCapability
func (*VideoLooperVP8) NextSample ¶
func (l *VideoLooperVP8) NextSample() (media.Sample, error)
func (*VideoLooperVP8) OnBind ¶
func (l *VideoLooperVP8) OnBind() error
func (*VideoLooperVP8) OnUnbind ¶
func (l *VideoLooperVP8) OnUnbind() error
func (*VideoLooperVP8) ToLayer ¶
func (l *VideoLooperVP8) ToLayer(quality rtp.VideoQuality) *rtp.SimulcastLayer