Skip to content

Commit 2a49b4a

Browse files
committed
The WebAudioSoundManager will no longer try to unlock itself if the Game hasn't already booted and been added to the DOM. It will now wait for the BOOT event and unlock based on that. Fix phaserjs#5439
1 parent 2e05983 commit 2a49b4a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/sound/webaudio/WebAudioSoundManager.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var Base64ToArrayBuffer = require('../../utils/base64/Base64ToArrayBuffer');
99
var BaseSoundManager = require('../BaseSoundManager');
1010
var Class = require('../../utils/Class');
1111
var Events = require('../events');
12+
var GameEvents = require('../../core/events');
1213
var WebAudioSound = require('./WebAudioSound');
1314

1415
/**
@@ -83,10 +84,14 @@ var WebAudioSoundManager = new Class({
8384

8485
BaseSoundManager.call(this, game);
8586

86-
if (this.locked)
87+
if (this.locked && game.isBooted)
8788
{
8889
this.unlock();
8990
}
91+
else
92+
{
93+
game.events.once(GameEvents.BOOT, this.unlock, this);
94+
}
9095
},
9196

9297
/**

0 commit comments

Comments
 (0)