Phaser API Documentation

  Version: 
play(key, [extra])

Description:

Adds a new sound to the sound manager and plays it. The sound 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.

extra Phaser.Types.Sound.SoundConfig | Phaser.Types.Sound.SoundMarker <optional>

An optional additional object containing settings to be applied to the sound. It could be either config or marker object.

Returns:
Description:

Whether the sound started playing successfully.

Type:
  • boolean
Since: 3.0.0