Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . Sound . NoAudioSound

This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . Sound . NoAudioSound

No audio implementation of the sound. It is used if audio has been disabled in the game config or the device doesn't support any audio.

It represents a graceful degradation of sound logic that provides minimal functionality and prevents Phaser projects that use audio from breaking on devices that don't support any audio playback technologies.

Constructor:

new NoAudioSound(manager, key, [config])

Parameters:

name type arguments Default description
manager Phaser.Sound.NoAudioSoundManager

Reference to the current sound manager instance.

key string

Asset key for the sound.

config Phaser.Types.Sound.SoundConfig <optional> {}

An optional config object containing default sound settings.

Since: 3.0.0

Methods

addMarker(marker)
Focus
Focus

Parameters:

name type description
marker Phaser.Types.Sound.SoundMarker

Marker object.

Returns:
Description:

false

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus
destroy()
Focus
Focus

Description:

Destroys this sound and all associated events and marks it for removal from the sound manager.

Examples:
Since: 3.0.0
Focus
Focus
pause()
Focus
Focus
Returns:
Description:

false

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus
play([markerName], [config])
Focus
Focus

Parameters:

name type arguments Default description
markerName string | Phaser.Types.Sound.SoundConfig <optional> ''

If you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object.

config Phaser.Types.Sound.SoundConfig <optional>

Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.

Returns:
Description:

false

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus
removeMarker(markerName)
Focus
Focus

Parameters:

name type description
markerName string

The name of the marker to remove.

Returns:
Description:

null

Type:
  • null
Examples:
Since: 3.0.0
Focus
Focus
resume()
Focus
Focus

Description:

Resumes the sound.

Returns:
Description:

false

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus
stop()
Focus
Focus

Description:

Stop playing this sound.

Returns:
Description:

false

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus
updateMarker(marker)
Focus
Focus

Parameters:

name type description
marker Phaser.Types.Sound.SoundMarker

Marker object with updated values.

Returns:
Description:

false

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus