Documentation ¶
Index ¶
- func RegisterDriverAdapter(a driver.Adapter, info driver.Info) error
- type AudioSource
- type AudioTrack
- func (track *AudioTrack) Bind(pc *webrtc.PeerConnection) (*webrtc.Track, error)
- func (track AudioTrack) Kind() MediaDeviceType
- func (track *AudioTrack) NewEncodedReader(codecName string) (io.ReadCloser, error)
- func (track *AudioTrack) NewRTPReader(codecName string, mtu int) (RTPReadCloser, error)
- func (track AudioTrack) OnEnded(handler func(error))
- func (track *AudioTrack) Transform(fns ...audio.TransformFunc)
- func (track *AudioTrack) Unbind(pc *webrtc.PeerConnection) error
- type CodecSelector
- type CodecSelectorOption
- 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(pc *webrtc.PeerConnection) (*webrtc.Track, error)
- func (track VideoTrack) Kind() MediaDeviceType
- func (track *VideoTrack) NewEncodedReader(codecName string) (io.ReadCloser, error)
- func (track *VideoTrack) NewRTPReader(codecName string, mtu int) (RTPReadCloser, error)
- func (track VideoTrack) OnEnded(handler func(error))
- func (track *VideoTrack) Transform(fns ...video.TransformFunc)
- func (track *VideoTrack) Unbind(pc *webrtc.PeerConnection) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AudioSource ¶ added in v0.1.2
AudioSource is a specific type of media source that emits a series of audio chunks
type AudioTrack ¶ added in v0.1.2
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 ¶ added in v0.1.2
func (track *AudioTrack) Bind(pc *webrtc.PeerConnection) (*webrtc.Track, error)
func (AudioTrack) Kind ¶ added in v0.1.2
func (track AudioTrack) Kind() MediaDeviceType
Kind returns track's kind
func (*AudioTrack) NewEncodedReader ¶ added in v0.1.5
func (track *AudioTrack) NewEncodedReader(codecName string) (io.ReadCloser, error)
func (*AudioTrack) NewRTPReader ¶ added in v0.1.4
func (track *AudioTrack) NewRTPReader(codecName string, mtu int) (RTPReadCloser, error)
func (AudioTrack) OnEnded ¶ added in v0.1.2
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 ¶ added in v0.1.2
func (track *AudioTrack) Transform(fns ...audio.TransformFunc)
Transform transforms the underlying source by applying the given fns in serial order
func (*AudioTrack) Unbind ¶ added in v0.1.2
func (track *AudioTrack) Unbind(pc *webrtc.PeerConnection) error
type CodecSelector ¶ added in v0.1.2
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 ¶ added in v0.1.2
func NewCodecSelector(opts ...CodecSelectorOption) *CodecSelector
NewCodecSelector constructs CodecSelector with given variadic options
func (*CodecSelector) Populate ¶ added in v0.1.2
func (selector *CodecSelector) Populate(setting *webrtc.MediaEngine)
Populate lets the webrtc engine be aware of supported codecs that are contained in CodecSelector
type CodecSelectorOption ¶ added in v0.1.2
type CodecSelectorOption func(*CodecSelector)
CodecSelectorOption is a type for specifying CodecSelector options
func WithAudioEncoders ¶ added in v0.1.2
func WithAudioEncoders(encoders ...codec.AudioEncoderBuilder) CodecSelectorOption
WithVideoEncoders replace current audio codecs with listed encoders
func WithVideoEncoders ¶ added in v0.1.2
func WithVideoEncoders(encoders ...codec.VideoEncoderBuilder) CodecSelectorOption
WithVideoEncoders replace current video codecs with listed encoders
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 ¶ added in v0.1.2
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 ¶ added in v0.1.2
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 ¶ added in v0.1.2
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 ¶ added in v0.1.4
type Track ¶ added in v0.1.2
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() MediaDeviceType // 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.PeerConnection) (*webrtc.Track, error) // Unbind is the clean up operation that should be called after Bind. Similar to Bind, unbind will // be called automatically in the future. Unbind(*webrtc.PeerConnection) 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, mtu int) (RTPReadCloser, error) // NewEncodedReader creates a new Go standard io.ReadCloser that reads the encoded data in codecName format NewEncodedReader(codecName string) (io.ReadCloser, error) }
Track is an interface that represent MediaStreamTrack Reference: https://w3c.github.io/mediacapture-main/#mediastreamtrack
func NewAudioTrack ¶ added in v0.1.2
func NewAudioTrack(source AudioSource, selector *CodecSelector) Track
NewAudioTrack constructs a new VideoTrack
func NewVideoTrack ¶ added in v0.1.2
func NewVideoTrack(source VideoSource, selector *CodecSelector) Track
NewVideoTrack constructs a new VideoTrack
type VideoSource ¶ added in v0.1.2
VideoSource is a specific type of media source that emits a series of video frames
type VideoTrack ¶ added in v0.1.2
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 ¶ added in v0.1.2
func (track *VideoTrack) Bind(pc *webrtc.PeerConnection) (*webrtc.Track, error)
func (VideoTrack) Kind ¶ added in v0.1.2
func (track VideoTrack) Kind() MediaDeviceType
Kind returns track's kind
func (*VideoTrack) NewEncodedReader ¶ added in v0.1.5
func (track *VideoTrack) NewEncodedReader(codecName string) (io.ReadCloser, error)
func (*VideoTrack) NewRTPReader ¶ added in v0.1.4
func (track *VideoTrack) NewRTPReader(codecName string, mtu int) (RTPReadCloser, error)
func (VideoTrack) OnEnded ¶ added in v0.1.2
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 ¶ added in v0.1.2
func (track *VideoTrack) Transform(fns ...video.TransformFunc)
Transform transforms the underlying source by applying the given fns in serial order
func (*VideoTrack) Unbind ¶ added in v0.1.2
func (track *VideoTrack) Unbind(pc *webrtc.PeerConnection) error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
examples
module
|
|
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/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. |