media

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package media wraps the JS MediaDevices API.

Index

Constants

View Source
const (
	VideoInput  DeviceKind = "videoinput"
	AudioInput             = "audioinput"
	AudioOutput            = "audiooutput"
)
View Source
const (
	User        FacingMode = "user"
	Environment            = "environment"
	Left                   = "left"
	Right                  = "right"
)
View Source
const (
	Exact Qualifier = "exact"
	Ideal           = "ideal"
	Max             = "max"
	Min             = "min"
)

Variables

This section is empty.

Functions

This section is empty.

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.

type DeviceKind

type DeviceKind string

type FacingMode

type FacingMode string

type Float

type Float map[Qualifier]float64

type Kind

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

type Qualifier

type Qualifier string

type Recorder

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

func NewRecorder

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

func (*Recorder) OnError

func (x *Recorder) OnError(fn func(error))

func (*Recorder) Pause

func (x *Recorder) Pause()

func (*Recorder) ReaderChain added in v0.2.5

func (x *Recorder) ReaderChain(dst msg.ReaderTaker) error

func (*Recorder) Release

func (x *Recorder) Release()

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            = "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 NewSource

func NewSource() *Source

func (*Source) NewBuffer

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

func (*Source) OnClose

func (x *Source) OnClose(fn func())

func (*Source) OnEnd

func (x *Source) OnEnd(fn func())

func (*Source) OnOpen

func (x *Source) OnOpen(fn func())

func (*Source) Release

func (x *Source) Release()

func (*Source) Url

func (x *Source) Url() string

Url returns a browser URL to the Source object.

type Stream

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

func AsStream

func AsStream(v js.Value) Stream

func Get

func Get(video VideoSettings) (Stream, error)

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.

func (Stream) Js

func (x Stream) Js() js.Value

func (Stream) VideoTracks

func (x Stream) VideoTracks() []VideoTrack

type Track

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

func AsTrack

func AsTrack(v js.Value) Track

func (Track) Js

func (x Track) Js() js.Value

func (Track) Kind added in v0.2.14

func (x Track) Kind() Kind

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 MakeVideoSettings

func MakeVideoSettings() 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 Track

func (VideoTrack) Apply

func (x VideoTrack) Apply(vs VideoSettings) error

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