Protected
Readonly
audioProtected
Readonly
audioAudioContext
for creating and playing audio nodes. This is automatically provided by a
parent AudioPlayer
.
Protected
Readonly
fetchInternal fetch implementation to use. This can be overridden with AudioFileParams.fetch
.
Readonly
gainReadonly
isIf true
, indicates that this AudioFile instance (or another instance within the same
AudioPlayer
) has detected that the current browser session is allowing audio playback. Most
browsers these days block audio on initial page load until the user has interacted with the
page.
Readonly
isIndicates if the AudioFile has been destroyed. If it has, this file should not be interacted with anymore. This is set by running AudioFile.destroy.
Protected
loadundefined
indicates that loading has not yet started (or has been unloaded).Promise
means that loading has begun (and might be finished).Protected
Readonly
outputThe AudioNode
that all playback should route to. If effects are provided, this will be the
first effect (because it'll sequentially route through all of the following effects,
eventually into the final volume GainNode
). If no effects are provided, this will simply be
the internal volume GainNode
.
Readonly
urlThe url or base64 string chosen from the originally provided list of sources that is most compatible with the current browser. This is what will be played.
Destroys this audio file entirely; it cannot be used anymore.
Load the audio file so it's ready to play. This will automatically be called on the first AudioFile.play call, but doing so will introduce latency to the first play.
Protected
loadLoad the audio file's AudioBuffer
through one of the following:
If a cache entry for this file does not already exist, this will create one.
Protected
loadLoad the audio file's ArrayBuffer
from its base64 encoded source string.
Protected
loadLoad the audio file's ArrayBuffer
from its source URL.
Play the audio file. If the audio file has not been loaded yet, it will be loaded before playing. If audio playing is disabled (which these days is often the case until the user interacts with the page), the file will not play. This resolves when the audio file has finished playing.
Whether or not the audio file was actually played. The audio file will not be played if audio is currently disabled.
An individual audio file.