Decode audio data into a format ready for playback via Web Audio.
The audio data can be a base64 encoded string, an audio media-type data uri, or an ArrayBuffer instance.
The audioKey
is the key that will be used to save the decoded audio to the audio cache.
Instead of passing a single entry you can instead pass an array of Phaser.Types.Sound.DecodeAudioConfig
objects as the first and only argument.
Decoding is an async process, so be sure to listen for the events to know when decoding has completed.
Once the audio has decoded it can be added to the Sound Manager or played via its key.
name | type | arguments | description |
---|---|---|---|
audioKey | string | Array.<Phaser.Types.Sound.DecodeAudioConfig> | <optional> |
The string-based key to be used to reference the decoded audio in the audio cache, or an array of audio config objects. |
audioData | ArrayBuffer | string | <optional> |
The audio data, either a base64 encoded string, an audio media-type data uri, or an ArrayBuffer instance. |