media

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flaot32To16BitPCM

func Flaot32To16BitPCM(raw []float32) []int16

Flaot32To16BitPCM converts float32 data to 16Bit PCM.

func GetUserMedia

func GetUserMedia(constrains StreamConstrains, success func(*Stream), fail func(*js.Error))

GetUserMedia ...

Types

type AudioBuffer

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

AudioBuffer https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer

func AudioBufferOf

func AudioBufferOf(x js.Value) *AudioBuffer

AudioBufferOf returns audio buffer.

func (*AudioBuffer) JSValue

func (buf *AudioBuffer) JSValue() js.Value

JSValue ...

func (*AudioBuffer) NumberOfChannels

func (buf *AudioBuffer) NumberOfChannels() int

NumberOfChannels https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer/numberOfChannels

func (*AudioBuffer) String

func (buf *AudioBuffer) String() string

type AudioContext

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

AudioContext https://developer.mozilla.org/en-US/docs/Web/API/AudioContext

func NewAudioContext

func NewAudioContext(sampleRate float64) *AudioContext

NewAudioContext return a audio context with specific sample rate.

func (*AudioContext) CreateMediaStreamSource

func (ctx *AudioContext) CreateMediaStreamSource(stream *Stream) *AudioNode

CreateMediaStreamSource https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createMediaStreamSource

func (*AudioContext) CreateScriptProcessor

func (ctx *AudioContext) CreateScriptProcessor(size BufSize, in, out int) *AudioNode

CreateScriptProcessor https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createScriptProcessor

func (*AudioContext) JSValue

func (ctx *AudioContext) JSValue() js.Value

JSValue ...

func (*AudioContext) OnClose

func (ctx *AudioContext) OnClose(cb func()) *AudioContext

OnClose invoked when context is closed.

func (*AudioContext) OnResume

func (ctx *AudioContext) OnResume(cb func()) *AudioContext

OnResume invoked when context is resumed.

func (*AudioContext) OnSuspend

func (ctx *AudioContext) OnSuspend(cb func()) *AudioContext

OnSuspend invoked when context is suspended.

func (*AudioContext) Release

func (ctx *AudioContext) Release()

Release frees up callback functions.

type AudioNode

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

AudioNode https://developer.mozilla.org/en-US/docs/Web/API/AudioNode

func AudioNodeOf

func AudioNodeOf(x js.Value) *AudioNode

AudioNodeOf returns a audio node.

func (*AudioNode) Connect

func (n *AudioNode) Connect(dest *AudioNode, index ...int) *AudioNode

Connect https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/connect

func (*AudioNode) Disconnect

func (n *AudioNode) Disconnect(dest *AudioNode, index ...int)

Disconnect https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/disconnect

func (*AudioNode) DisconnectAll

func (n *AudioNode) DisconnectAll()

DisconnectAll disconnects all destination nodes.

func (*AudioNode) JSValue

func (n *AudioNode) JSValue() js.Value

JSValue ...

type AudioState

type AudioState string

AudioState state for AudioConext.

const (
	Suspended AudioState = "suspended"
	Running   AudioState = "running"
	Closed    AudioState = "closed"
)

AudioContext State https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state

type BufSize

type BufSize int

BufSize buffer size for script processor.

const (
	Size256   BufSize = 256
	Size512   BufSize = 512
	Size1024  BufSize = 1024
	Size2048  BufSize = 2048
	Size4096  BufSize = 4096
	Size8192  BufSize = 8192
	Size16384 BufSize = 16384
)

buffer https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/createScriptProcessor#Parameters

type Stream

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

Stream https://developer.mozilla.org/en-US/docs/Web/API/MediaStream

func StreamOf

func StreamOf(v js.Value) *Stream

StreamOf returns a media stream.

func (*Stream) JSValue

func (stream *Stream) JSValue() js.Value

JSValue ...

func (*Stream) Ready

func (stream *Stream) Ready() bool

Ready ...

type StreamConstrains

type StreamConstrains struct {
	Audio bool
	Video bool
}

StreamConstrains ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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