media

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package media wraps the JS MediaDevices API.

Index

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 Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

func (*Buffer) Write

func (x *Buffer) Write(b []byte) error

type Device

type Device struct {
	Id      string
	GroupId string
}

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 Float

type Float map[Qualifier]float64

type Kind

type Kind string
const (
	Audio Kind = "audio"
	Video Kind = "video"
)

type Qualifier

type Qualifier string
const (
	Exact Qualifier = "exact"
	Ideal Qualifier = "ideal"
	Max   Qualifier = "max"
	Min   Qualifier = "min"
)

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

func RecorderMake added in v0.3.0

func RecorderMake(s Stream, t Type, audioBitRate, videoBitRate float64) *Recorder

func (*Recorder) DataHandle added in v0.3.0

func (x *Recorder) DataHandle(fn wasm.Function)

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)

func (*Recorder) Pause

func (x *Recorder) Pause()

func (*Recorder) Resume

func (x *Recorder) Resume(d time.Duration)

func (*Recorder) Start

func (x *Recorder) Start(d time.Duration)

Start starts recording. Writes output every d.

func (*Recorder) Stop

func (x *Recorder) Stop()

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.

func (Settings) Device

func (x Settings) Device() (Qualifier, string)

func (Settings) DeviceSet

func (x Settings) DeviceSet(q Qualifier, id string)

func (Settings) Group

func (x Settings) Group() (Qualifier, string)

func (Settings) GroupSet

func (x Settings) GroupSet(q Qualifier, id string)

type Source

type Source struct {
	// contains filtered or unexported fields
}

func SourceMake added in v0.3.0

func SourceMake() *Source

func (*Source) Buffer added in v0.3.0

func (x *Source) Buffer(t Type) *Buffer

func (*Source) CloseHandle added in v0.3.0

func (x *Source) CloseHandle(fn func())

func (*Source) EndHandle added in v0.3.0

func (x *Source) EndHandle(fn func())

func (*Source) OpenHandle added in v0.3.0

func (x *Source) OpenHandle(fn func())

func (*Source) Url

func (x *Source) Url() string

Url returns a browser URL to the Source object.

func (*Source) Wipe added in v0.3.0

func (x *Source) Wipe()

type Stream

type Stream struct {
	V wasm.Value
}

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

func GetDisplay() (Stream, error)

GetDisplay returns a display screen stream.

Must not be called from the event loop.

func (Stream) VideoTracks

func (x Stream) VideoTracks() []VideoTrack

type Track

type Track struct {
	V wasm.Value
	// contains filtered or unexported fields
}

func (*Track) EndHandle added in v0.3.0

func (x *Track) EndHandle(fn func())

func (*Track) Kind added in v0.2.14

func (x *Track) Kind() Kind

func (*Track) Stop added in v0.3.0

func (x *Track) Stop()

func (*Track) Wipe added in v0.3.0

func (x *Track) Wipe()

type Type

type Type interface {
	Kind() Kind
	Format() string
	Codec() string
}

type Uint

type Uint map[Qualifier]uint64

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

Directories

Path Synopsis
Package webm implements the WebM media type.
Package webm implements the WebM media type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL