Skip to main content
Version: Phaser v4.0.0-rc.6

HTML5AudioFile

A single Audio File suitable for loading by the Loader.

These are created when you use the Phaser.Loader.LoaderPlugin#audio method and are not typically created directly.

For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audio.

Constructor

new HTML5AudioFile(loader, key, [urlConfig], [xhrSettings])

Parameters

nametypeoptionaldescription
loaderPhaser.Loader.LoaderPluginNoA reference to the Loader that is responsible for this file.
keystring | Phaser.Types.Loader.FileTypes.AudioFileConfigNoThe key to use for this file, or a file configuration object.
urlConfigstringYesThe absolute or relative URL to load this file from.
xhrSettingsPhaser.Types.Loader.XHRSettingsObjectYesExtra XHR Settings specifically for this file.

Scope: static

Extends

Phaser.Loader.File

Source: src/loader/filetypes/HTML5AudioFile.js#L14
Since: 3.0.0

Inherited Methods

From Phaser.Loader.File:


Public Methods

load

<instance> load()

Description:

Called by the Loader, starts the actual file downloading.

During the load the methods onLoad, onError and onProgress are called, based on the XHR events.

You shouldn't normally call this method directly, it's meant to be invoked by the Loader.

Overrides: Phaser.Loader.File#load

Source: src/loader/filetypes/HTML5AudioFile.js#L130
Since: 3.0.0


onError

<instance> onError()

Description:

Called if the file errors while loading.

Overrides: Phaser.Loader.File#onError

Source: src/loader/filetypes/HTML5AudioFile.js#L85
Since: 3.0.0


onLoad

<instance> onLoad()

Description:

Called when the file finishes loading.

Overrides: Phaser.Loader.File#onLoad

Source: src/loader/filetypes/HTML5AudioFile.js#L67
Since: 3.0.0


onProgress

<instance> onProgress()

Description:

Called during the file load progress. Is sent a DOM ProgressEvent.

Overrides: Phaser.Loader.File#onProgress

Fires: Phaser.Loader.Events#event:FILE_PROGRESS

Source: src/loader/filetypes/HTML5AudioFile.js#L104
Since: 3.0.0


Inherited Members

From Phaser.Loader.File: