Phaser API Documentation

  Version: 
playAudioSprite(key, spriteName, [config])

Description:

Adds a new audio sprite sound to the sound manager and plays it. The sprite will be automatically removed (destroyed) once playback ends. This lets you play a new sound on the fly without the need to keep a reference to it.

Parameters:

name type arguments description
key string

Asset key for the sound.

spriteName string

The name of the sound sprite to play.

config Phaser.Types.Sound.SoundConfig <optional>

An optional config object containing default sound settings.

Returns:
Description:

Whether the audio sprite sound started playing successfully.

Type:
  • boolean
Since: 3.0.0