Class: AudioItem

AudioItem(urlopt, configopt)

Represents an audio item that can be loaded, played, and manipulated. Extends the BaseAudio class to provide additional functionality for handling audio data.

Constructor

new AudioItem(urlopt, configopt)

Creates an instance of AudioItem.
Parameters:
Name Type Attributes Default Description
url string | null <optional>
null The URL of the audio file to load.
config Object <optional>
{} Configuration for the audio item.
Source:

Classes

AudioItem

Members

loop

Gets the loop property.
Source:

pitch

Gets the pitch value.
Source:

Methods

connect(audioMixer)

Connects the current instance to the provided audio mixer. If already connected to a different audio mixer, it will first disconnect from the current one.
Parameters:
Name Type Description
audioMixer Object The audio mixer to connect to.
Source:

disconnect()

Disconnects the current instance from the audio mixer. If an audio mixer is connected, it stops the audio and disconnects the instance from the mixer.
Source:

(async) load(url) → {Promise.<void>}

Asynchronously loads audio data from the provided URL.
Parameters:
Name Type Description
url string The URL of the audio resource to load.
Source:
Returns:
A promise that resolves when the audio data is loaded.
Type
Promise.<void>

play(fromopt)

Starts playing the audio from a specified time.
Parameters:
Name Type Attributes Default Description
from number <optional>
0 The time in seconds from which to start playing the audio.
Source:

resume()

Resumes playback from the specified start time.
Source:

stop()

Stops the audio playback and updates the start time based on the current playback position. If an audio mixer and buffer are present, the start time is recalculated to allow resuming from the same position.
Source:

unload()

Unloads the current instance by disconnecting and clearing the buffer.
Source: