Class: HTMLAudioInstance

htmlaudio.HTMLAudioInstance

Instance which wraps the <audio> element playback.

new htmlaudio.HTMLAudioInstance (parent)

Name Type Description
parent htmlaudio.HTMLAudioMedia

Parent element

Extends

  • PIXI.util.EventEmitter

Implements

Members

htmlaudio.HTMLAudioInstance.PADDING number staticreadonly

Extra padding, in seconds, to deal with low-latecy of HTMLAudio.

Default Value:
  • 0.1

filters filters.Filter[]

HTML Audio does not support filters, this is non-functional API.

id number readonly

The current unique ID for this instance.

loop boolean

If the sound instance should loop playback

muted boolean

true if the sound is muted

paused boolean overrides

Pauses the sound.

progress number overrides

The current playback progress from 0 to 1.

speed number

Set the instance speed from 0 to 1

volume number

Get the set the volume for this instance from 0 to 1

Methods

destroy () void

Don't use after this.

init (media) void

Initialize the instance.

Name Type Description
media htmlaudio.HTMLAudioMedia

Same as constructor

play (options) void

Start playing the sound/

Name Type Description
options PlayOptions

refresh () void

Call whenever the loop, speed or volume changes

refreshPaused () void

Handle changes in paused state, either globally or sound or instance

set (name, value) this

Set a property by name, this makes it easy to chain values

Name Type Description
name "speed" | "volume" | "muted" | "loop" | "paused"

Name of the property to set

value number | boolean

Value to set property to

Returns:
Type Description
this

stop () void overrides

Stop the sound playing

toString () string

To string method for instance.

Returns:
Type Description
string The string representation of instance.

Inherited Events