Phaser API Documentation

  Version: 
createAudioContext(game)

Description:

Method responsible for instantiating and returning AudioContext instance. If an instance of an AudioContext class was provided through the game config, that instance will be returned instead. This can come in handy if you are reloading a Phaser game on a page that never properly refreshes (such as in an SPA project) and you want to reuse already instantiated AudioContext.

Parameters:

name type description
game Phaser.Game

Reference to the current game instance.

Returns:
Description:

The AudioContext instance to be used for playback.

Type:
  • AudioContext
Since: 3.0.0