Skip to content

Commit 3f8911d

Browse files
committed
SoundManager.boot will check to see if the AudioContext was created before carrying on (thanks @keyle, fix phaserjs#669)
1 parent 4f5b329 commit 3f8911d

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Bug Fixes
9292
* Fixed issue where visibility was not being respected in sprite batch (pixi.js 1.5.2 bug fix)
9393
* Fixed bug in gl.bindTexture which tried to use an undefined private var. (@photonstorm) (pixi.js 1.5.2 bug fix)
9494
* Fixed the 'short cut' version of Math.floor in setTransform if roundPixels is true. (@photonstorm) (pixi.js 1.5.2 bug fix)
95+
* SoundManager.boot will check to see if the AudioContext was created before carrying on (thanks @keyle, fix #669)
9596

9697

9798
ToDo

src/sound/SoundManager.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,24 @@ Phaser.SoundManager.prototype = {
155155

156156
if (!!window['AudioContext'])
157157
{
158-
this.context = new window['AudioContext']();
158+
try {
159+
this.context = new window['AudioContext']();
160+
} catch (error) {
161+
this.context = null;
162+
this.usingWebAudio = false;
163+
}
159164
}
160165
else if (!!window['webkitAudioContext'])
161166
{
162-
this.context = new window['webkitAudioContext']();
167+
try {
168+
this.context = new window['webkitAudioContext']();
169+
} catch (error) {
170+
this.context = null;
171+
this.usingWebAudio = false;
172+
}
163173
}
164-
else if (!!window['Audio'])
174+
175+
if (!!window['Audio'] && this.context === null)
165176
{
166177
this.usingWebAudio = false;
167178
this.usingAudioTag = true;

0 commit comments

Comments
 (0)