Documentation
¶
Overview ¶
Package media wraps the JS MediaDevices API.
Index ¶
- func ArrayBufferInterfaceMake(dst msg.ReaderTaker, errorFunc func(error)) wasm.Interface
- type Buffer
- type Device
- type DeviceKind
- type FacingMode
- type Float
- type Kind
- type Qualifier
- type Recorder
- type ResizeMode
- type Settings
- type Source
- type Stream
- type Track
- type Type
- type Uint
- type VideoSettings
- func (x VideoSettings) AspectRatio() Float
- func (x VideoSettings) AspectRatioSet(f Float)
- func (x VideoSettings) FacingMode() (Qualifier, FacingMode)
- func (x VideoSettings) FacingModeSet(q Qualifier, fm FacingMode)
- func (x VideoSettings) FrameRate() Float
- func (x VideoSettings) FrameRateSet(f Float)
- func (x VideoSettings) Height() Uint
- func (x VideoSettings) HeightSet(u Uint)
- func (x VideoSettings) ResizeMode() ResizeMode
- func (x VideoSettings) ResizeModeSet(rm ResizeMode)
- func (x VideoSettings) Width() Uint
- func (x VideoSettings) WidthSet(u Uint)
- type VideoTrack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayBufferInterfaceMake ¶ added in v0.3.0
func ArrayBufferInterfaceMake(dst msg.ReaderTaker, errorFunc func(error)) wasm.Interface
An ArrayBufferInterface can be used to create Function(ArrayBuffer) that transfer data to a destination.
Types ¶
type Device ¶
func Devices ¶
func Devices(kind DeviceKind) ([]Device, error)
Devices returns a slice of all available devices of the specified kind.
Must not be called from the event loop.
type DeviceKind ¶
type DeviceKind string
const ( VideoInput DeviceKind = "videoinput" AudioInput DeviceKind = "audioinput" AudioOutput DeviceKind = "audiooutput" )
type FacingMode ¶
type FacingMode string
const ( User FacingMode = "user" Environment FacingMode = "environment" Left FacingMode = "left" Right FacingMode = "right" )
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
func RecorderMake ¶ added in v0.3.0
func (*Recorder) DataHandle ¶ added in v0.3.0
fn - Function({"data": {"arrayBuffer": Function() Promise(ArrayBuffer)}})
func (*Recorder) DataInterface ¶ added in v0.3.0
func (x *Recorder) DataInterface(fn wasm.Function) wasm.InterfaceFunc
DataInterface can be used to create Functions for the DataHandle method.
fn - Function(ArrayBuffer)
type ResizeMode ¶
type ResizeMode string
const ( None ResizeMode = "none" CropScape ResizeMode = "crop-and-scale" )
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
Settings defines a set of properties common to all stream types.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
func SourceMake ¶ added in v0.3.0
func SourceMake() *Source
func (*Source) CloseHandle ¶ added in v0.3.0
func (x *Source) CloseHandle(fn func())
func (*Source) OpenHandle ¶ added in v0.3.0
func (x *Source) OpenHandle(fn func())
type Stream ¶
func Get ¶
func Get(video VideoSettings) (Stream, error)
Get returns a camera video stream.
If a setting is a zero value, it will be ignored. Unmodified settings obtained from a respective make function is equivalent to requesting any stream of that kind.
Must not be called from the event loop.
func GetDisplay ¶ added in v0.3.0
GetDisplay returns a display screen stream.
Must not be called from the event loop.
func (Stream) VideoTracks ¶
func (x Stream) VideoTracks() []VideoTrack
type VideoSettings ¶
type VideoSettings struct {
Settings
}
func VideoSettingsMake ¶ added in v0.3.0
func VideoSettingsMake() VideoSettings
func (VideoSettings) AspectRatio ¶
func (x VideoSettings) AspectRatio() Float
func (VideoSettings) AspectRatioSet ¶
func (x VideoSettings) AspectRatioSet(f Float)
func (VideoSettings) FacingMode ¶
func (x VideoSettings) FacingMode() (Qualifier, FacingMode)
func (VideoSettings) FacingModeSet ¶
func (x VideoSettings) FacingModeSet(q Qualifier, fm FacingMode)
func (VideoSettings) FrameRate ¶
func (x VideoSettings) FrameRate() Float
func (VideoSettings) FrameRateSet ¶
func (x VideoSettings) FrameRateSet(f Float)
func (VideoSettings) Height ¶
func (x VideoSettings) Height() Uint
func (VideoSettings) HeightSet ¶
func (x VideoSettings) HeightSet(u Uint)
func (VideoSettings) ResizeMode ¶
func (x VideoSettings) ResizeMode() ResizeMode
func (VideoSettings) ResizeModeSet ¶
func (x VideoSettings) ResizeModeSet(rm ResizeMode)
func (VideoSettings) Width ¶
func (x VideoSettings) Width() Uint
func (VideoSettings) WidthSet ¶
func (x VideoSettings) WidthSet(u Uint)
type VideoTrack ¶
type VideoTrack struct {
*Track
}
func (VideoTrack) Apply ¶
func (x VideoTrack) Apply(vs VideoSettings) error
Must not be called from the event loop.
func (VideoTrack) Capabilities ¶
func (x VideoTrack) Capabilities() VideoSettings
func (VideoTrack) Settings ¶
func (x VideoTrack) Settings() VideoSettings