Skip to main content

Class: MediaElementSource

Defined in: src/audio/spatialAudioSources.ts:44

A PositionalSource backed by an <audio> / <video> element.

The caller wires the element's MediaElementAudioSourceNode into the panner before constructing this wrapper; the wrapper controls transport only.

Implements​

Constructors​

Constructor​

new MediaElementSource(_element): MediaElementSource

Defined in: src/audio/spatialAudioSources.ts:45

Parameters​

_element​

HTMLMediaElement

Returns​

MediaElementSource

Methods​

pause()​

pause(): void

Defined in: src/audio/spatialAudioSources.ts:52

Pause playback, keeping the position when the source supports it.

Returns​

void

Implementation of​

PositionalSource.pause


play()​

play(): void

Defined in: src/audio/spatialAudioSources.ts:47

Start (or resume) playback.

Returns​

void

Implementation of​

PositionalSource.play


setVolume()​

setVolume(value): void

Defined in: src/audio/spatialAudioSources.ts:61

Set the source volume, clamped to [0, 1].

Parameters​

value​

number

Returns​

void

Implementation of​

PositionalSource.setVolume


stop()​

stop(): void

Defined in: src/audio/spatialAudioSources.ts:56

Stop playback and reset to the start.

Returns​

void

Implementation of​

PositionalSource.stop