Documentation ¶
Index ¶
- func RegisterDriverAdapter(a driver.Adapter, info driver.Info) error
- type AudioSource
- type AudioTrack
- func (track *AudioTrack) Bind(ctx webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)
- func (track AudioTrack) Kind() webrtc.RTPCodecType
- func (track *AudioTrack) NewEncodedIOReader(codecName string) (io.ReadCloser, error)
- func (track *AudioTrack) NewEncodedReader(codecName string) (EncodedReadCloser, error)
- func (track *AudioTrack) NewRTPReader(codecName string, ssrc uint32, mtu int) (RTPReadCloser, error)
- func (track AudioTrack) OnEnded(handler func(error))
- func (track AudioTrack) StreamID() string
- func (track *AudioTrack) Transform(fns ...audio.TransformFunc)
- func (track *AudioTrack) Unbind(ctx webrtc.TrackLocalContext) error
- type CodecSelector
- type CodecSelectorOption
- type EncodedBuffer
- type EncodedReadCloser
- type MediaDeviceInfo
- type MediaDeviceType
- type MediaOption
- type MediaStream
- type MediaStreamConstraints
- type MediaTrackConstraints
- type RTPReadCloser
- type Source
- type Track
- type VideoSource
- type VideoTrack
- func (track *VideoTrack) Bind(ctx webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)
- func (track VideoTrack) Kind() webrtc.RTPCodecType
- func (track *VideoTrack) NewEncodedIOReader(codecName string) (io.ReadCloser, error)
- func (track *VideoTrack) NewEncodedReader(codecName string) (EncodedReadCloser, error)
- func (track *VideoTrack) NewRTPReader(codecName string, ssrc uint32, mtu int) (RTPReadCloser, error)
- func (track VideoTrack) OnEnded(handler func(error))
- func (track VideoTrack) StreamID() string
- func (track *VideoTrack) Transform(fns ...video.TransformFunc)
- func (track *VideoTrack) Unbind(ctx webrtc.TrackLocalContext) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AudioSource ¶
AudioSource is a specific type of media source that emits a series of audio chunks
type AudioTrack ¶
type AudioTrack struct { *audio.Broadcaster // contains filtered or unexported fields }
AudioTrack is a specific track type that contains audio source which allows multiple readers to access, and manipulate.
func (*AudioTrack) Bind ¶
func (track *AudioTrack) Bind(ctx webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)
func (AudioTrack) Kind ¶
func (track AudioTrack) Kind() webrtc.RTPCodecType
Kind returns track's kind
func (*AudioTrack) NewEncodedIOReader ¶
func (track *AudioTrack) NewEncodedIOReader(codecName string) (io.ReadCloser, error)
func (*AudioTrack) NewEncodedReader ¶
func (track *AudioTrack) NewEncodedReader(codecName string) (EncodedReadCloser, error)
func (*AudioTrack) NewRTPReader ¶
func (track *AudioTrack) NewRTPReader(codecName string, ssrc uint32, mtu int) (RTPReadCloser, error)
func (AudioTrack) OnEnded ¶
func (track AudioTrack) OnEnded(handler func(error))
OnEnded sets an error handler. When a track has been created and started, if an error occurs, handler will get called with the error given to the parameter.
func (*AudioTrack) Transform ¶
func (track *AudioTrack) Transform(fns ...audio.TransformFunc)
Transform transforms the underlying source by applying the given fns in serial order
func (*AudioTrack) Unbind ¶
func (track *AudioTrack) Unbind(ctx webrtc.TrackLocalContext) error
type CodecSelector ¶
type CodecSelector struct {
// contains filtered or unexported fields
}
CodecSelector is a container of video and audio encoder builders, which later will be used for codec matching.
func NewCodecSelector ¶
func NewCodecSelector(opts ...CodecSelectorOption) *CodecSelector
NewCodecSelector constructs CodecSelector with given variadic options
func (*CodecSelector) Populate ¶
func (selector *CodecSelector) Populate(setting *webrtc.MediaEngine)
Populate lets the webrtc engine be aware of supported codecs that are contained in CodecSelector
type CodecSelectorOption ¶
type CodecSelectorOption func(*CodecSelector)
CodecSelectorOption is a type for specifying CodecSelector options
func WithAudioEncoders ¶
func WithAudioEncoders(encoders ...codec.AudioEncoderBuilder) CodecSelectorOption
WithVideoEncoders replace current audio codecs with listed encoders
func WithVideoEncoders ¶
func WithVideoEncoders(encoders ...codec.VideoEncoderBuilder) CodecSelectorOption
WithVideoEncoders replace current video codecs with listed encoders
type EncodedBuffer ¶
type EncodedReadCloser ¶
type EncodedReadCloser interface { Read() (EncodedBuffer, func(), error) Close() error }
type MediaDeviceInfo ¶
type MediaDeviceInfo struct { DeviceID string Kind MediaDeviceType Label string DeviceType driver.DeviceType }
MediaDeviceInfo represents https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo
func EnumerateDevices ¶
func EnumerateDevices() []MediaDeviceInfo
type MediaDeviceType ¶
type MediaDeviceType int
MediaDeviceType enumerates type of media device.
const ( VideoInput MediaDeviceType = iota + 1 AudioInput AudioOutput )
MediaDeviceType definitions.
type MediaOption ¶
type MediaOption func(*MediaTrackConstraints)
type MediaStream ¶
type MediaStream interface { // GetAudioTracks implements https://w3c.github.io/mediacapture-main/#dom-mediastream-getaudiotracks GetAudioTracks() []Track // GetVideoTracks implements https://w3c.github.io/mediacapture-main/#dom-mediastream-getvideotracks GetVideoTracks() []Track // GetTracks implements https://w3c.github.io/mediacapture-main/#dom-mediastream-gettracks GetTracks() []Track // AddTrack implements https://w3c.github.io/mediacapture-main/#dom-mediastream-addtrack AddTrack(t Track) // RemoveTrack implements https://w3c.github.io/mediacapture-main/#dom-mediastream-removetrack RemoveTrack(t Track) }
MediaStream is an interface that represents a collection of existing tracks.
func GetDisplayMedia ¶
func GetDisplayMedia(constraints MediaStreamConstraints) (MediaStream, error)
GetDisplayMedia prompts the user to select and grant permission to capture the contents of a display or portion thereof (such as a window) as a MediaStream. Reference: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia
func GetUserMedia ¶
func GetUserMedia(constraints MediaStreamConstraints) (MediaStream, error)
GetUserMedia prompts the user for permission to use a media input which produces a MediaStream with tracks containing the requested types of media. Reference: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
func NewMediaStream ¶
func NewMediaStream(tracks ...Track) (MediaStream, error)
NewMediaStream creates a MediaStream interface that's defined in https://w3c.github.io/mediacapture-main/#dom-mediastream
type MediaStreamConstraints ¶
type MediaStreamConstraints struct { Audio MediaOption Video MediaOption Codec *CodecSelector }
type MediaTrackConstraints ¶
type MediaTrackConstraints struct { prop.MediaConstraints // contains filtered or unexported fields }
MediaTrackConstraints represents https://w3c.github.io/mediacapture-main/#dom-mediatrackconstraints
type RTPReadCloser ¶
type Track ¶
type Track interface { Source // OnEnded registers a handler to receive an error from the media stream track. // If the error is already occured before registering, the handler will be // immediately called. OnEnded(func(error)) Kind() webrtc.RTPCodecType // StreamID is the group this track belongs too. This must be unique StreamID() string // Bind binds the current track source to the given peer connection. In Pion/webrtc v3, the bind // call will happen automatically after the SDP negotiation. Users won't need to call this manually. Bind(webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error) // Unbind is the clean up operation that should be called after Bind. Similar to Bind, unbind will // be called automatically in Pion/webrtc v3. Unbind(webrtc.TrackLocalContext) error // NewRTPReader creates a new reader from the source. The reader will encode the source, and packetize // the encoded data in RTP format with given mtu size. NewRTPReader(codecName string, ssrc uint32, mtu int) (RTPReadCloser, error) // NewEncodedReader creates a EncodedReadCloser that reads the encoded data in codecName format NewEncodedReader(codecName string) (EncodedReadCloser, error) // NewEncodedReader creates a new Go standard io.ReadCloser that reads the encoded data in codecName format NewEncodedIOReader(codecName string) (io.ReadCloser, error) }
Track is an interface that represent MediaStreamTrack Reference: https://w3c.github.io/mediacapture-main/#mediastreamtrack
func NewAudioTrack ¶
func NewAudioTrack(source AudioSource, selector *CodecSelector) Track
NewAudioTrack constructs a new VideoTrack
func NewVideoTrack ¶
func NewVideoTrack(source VideoSource, selector *CodecSelector) Track
NewVideoTrack constructs a new VideoTrack
type VideoSource ¶
VideoSource is a specific type of media source that emits a series of video frames
type VideoTrack ¶
type VideoTrack struct { *video.Broadcaster // contains filtered or unexported fields }
VideoTrack is a specific track type that contains video source which allows multiple readers to access, and manipulate.
func (*VideoTrack) Bind ¶
func (track *VideoTrack) Bind(ctx webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)
func (VideoTrack) Kind ¶
func (track VideoTrack) Kind() webrtc.RTPCodecType
Kind returns track's kind
func (*VideoTrack) NewEncodedIOReader ¶
func (track *VideoTrack) NewEncodedIOReader(codecName string) (io.ReadCloser, error)
func (*VideoTrack) NewEncodedReader ¶
func (track *VideoTrack) NewEncodedReader(codecName string) (EncodedReadCloser, error)
func (*VideoTrack) NewRTPReader ¶
func (track *VideoTrack) NewRTPReader(codecName string, ssrc uint32, mtu int) (RTPReadCloser, error)
func (VideoTrack) OnEnded ¶
func (track VideoTrack) OnEnded(handler func(error))
OnEnded sets an error handler. When a track has been created and started, if an error occurs, handler will get called with the error given to the parameter.
func (*VideoTrack) Transform ¶
func (track *VideoTrack) Transform(fns ...video.TransformFunc)
Transform transforms the underlying source by applying the given fns in serial order
func (*VideoTrack) Unbind ¶
func (track *VideoTrack) Unbind(ctx webrtc.TrackLocalContext) error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
pkg
|
|
avfoundation
Package avfoundation provides AVFoundation binding for Go
|
Package avfoundation provides AVFoundation binding for Go |
codec/mmal
Package mmal implements a hardware accelerated H264 encoder for raspberry pi.
|
Package mmal implements a hardware accelerated H264 encoder for raspberry pi. |
codec/vaapi
Package vaapi implements hardware accelerated codecs.
|
Package vaapi implements hardware accelerated codecs. |
codec/vpx
Package vpx implements VP8 and VP9 encoder.
|
Package vpx implements VP8 and VP9 encoder. |
codec/x264
Package x264 implements H264 encoder.
|
Package x264 implements H264 encoder. |
driver/audiotest
Package audiotest provides dummy audio driver for testing.
|
Package audiotest provides dummy audio driver for testing. |
driver/camera
Package camera provides a video camera driver.
|
Package camera provides a video camera driver. |
driver/videotest
Package videotest provides dummy video driver for testing.
|
Package videotest provides dummy video driver for testing. |
wave
Package wave implements a basic audio data library.
|
Package wave implements a basic audio data library. |