Documentation
¶
Index ¶
- func RegisterDriverAdapter(a driver.Adapter, info driver.Info) error
- type LocalTrack
- type MediaDeviceInfo
- type MediaDeviceType
- type MediaDevices
- type MediaDevicesOption
- type MediaDevicesOptions
- type MediaOption
- type MediaStream
- type MediaStreamConstraints
- type MediaTrackConstraints
- type TrackGenerator
- type Tracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LocalTrack ¶
type MediaDeviceInfo ¶
type MediaDeviceInfo struct {
DeviceID string
Kind MediaDeviceType
Label string
DeviceType driver.DeviceType
}
MediaDeviceInfo represents https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo
type MediaDeviceType ¶
type MediaDeviceType int
MediaDeviceType enumerates type of media device.
const ( VideoInput MediaDeviceType = iota AudioInput AudioOutput )
MediaDeviceType definitions.
type MediaDevices ¶
type MediaDevices interface {
GetDisplayMedia(constraints MediaStreamConstraints) (MediaStream, error)
GetUserMedia(constraints MediaStreamConstraints) (MediaStream, error)
EnumerateDevices() []MediaDeviceInfo
}
MediaDevices is an interface that's defined on https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices
func NewMediaDevices ¶
func NewMediaDevices(pc *webrtc.PeerConnection, opts ...MediaDevicesOption) MediaDevices
NewMediaDevices creates MediaDevices interface that provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data.
func NewMediaDevicesFromCodecs ¶
func NewMediaDevicesFromCodecs(codecs map[webrtc.RTPCodecType][]*webrtc.RTPCodec, opts ...MediaDevicesOption) MediaDevices
NewMediaDevicesFromCodecs creates MediaDevices interface from lists of the available codecs that provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data.
type MediaDevicesOption ¶
type MediaDevicesOption func(*MediaDevicesOptions)
MediaDevicesOption is a type of MediaDevices functional option.
func WithTrackGenerator ¶
func WithTrackGenerator(gen TrackGenerator) MediaDevicesOption
WithTrackGenerator specifies a TrackGenerator to use customized track.
type MediaDevicesOptions ¶
type MediaDevicesOptions struct {
// contains filtered or unexported fields
}
MediaDevicesOptions stores parameters used by MediaDevices.
type MediaOption ¶
type MediaOption func(*MediaTrackConstraints)
type MediaStream ¶
type MediaStream interface {
// GetAudioTracks implements https://w3c.github.io/mediacapture-main/#dom-mediastream-getaudiotracks
GetAudioTracks() []Tracker
// GetVideoTracks implements https://w3c.github.io/mediacapture-main/#dom-mediastream-getvideotracks
GetVideoTracks() []Tracker
// GetTracks implements https://w3c.github.io/mediacapture-main/#dom-mediastream-gettracks
GetTracks() []Tracker
// AddTrack implements https://w3c.github.io/mediacapture-main/#dom-mediastream-addtrack
AddTrack(t Tracker)
// RemoveTrack implements https://w3c.github.io/mediacapture-main/#dom-mediastream-removetrack
RemoveTrack(t Tracker)
}
MediaStream is an interface that represents a collection of existing tracks.
func NewMediaStream ¶
func NewMediaStream(trackers ...Tracker) (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
}
type MediaTrackConstraints ¶
type MediaTrackConstraints struct {
prop.MediaConstraints
Enabled bool
// VideoEncoderBuilders are codec builders that are used for encoding the video
// and later being used for sending the appropriate RTP payload type.
//
// If one encoder builder fails to build the codec, the next builder will be used,
// repeating until a codec builds. If no builders build successfully, an error is returned.
VideoEncoderBuilders []codec.VideoEncoderBuilder
// AudioEncoderBuilders are codec builders that are used for encoding the audio
// and later being used for sending the appropriate RTP payload type.
//
// If one encoder builder fails to build the codec, the next builder will be used,
// repeating until a codec builds. If no builders build successfully, an error is returned.
AudioEncoderBuilders []codec.AudioEncoderBuilder
// VideoTransform will be used to transform the video that's coming from the driver.
// So, basically it'll look like following: driver -> VideoTransform -> codec
VideoTransform video.TransformFunc
// AudioTransform will be used to transform the audio that's coming from the driver.
// So, basically it'll look like following: driver -> AudioTransform -> code
AudioTransform audio.TransformFunc
// contains filtered or unexported fields
}
MediaTrackConstraints represents https://w3c.github.io/mediacapture-main/#dom-mediatrackconstraints
type TrackGenerator ¶
type TrackGenerator func(payloadType uint8, ssrc uint32, id, label string, codec *webrtc.RTPCodec) (LocalTrack, error)
TrackGenerator is a function to create new track.
type Tracker ¶
type Tracker interface {
Track() *webrtc.Track
LocalTrack() LocalTrack
Stop()
// 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))
}
Tracker is an interface that represent MediaStreamTrack Reference: https://w3c.github.io/mediacapture-main/#mediastreamtrack
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/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. |
|
codec/ffmpeg
module
|
