Skip to content

Commit f0cbfba

Browse files
authored
Merge pull request phaserjs#5161 from samme/fix/stopAndReleaseAudioTag
Fix error stopping HTML5AudioSound after page blur
2 parents 5484100 + 36f08e7 commit f0cbfba

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,15 @@ var HTML5AudioSound = new Class({
382382
*/
383383
stopAndReleaseAudioTag: function ()
384384
{
385-
this.audio.pause();
386-
this.audio.dataset.used = 'false';
387-
this.audio = null;
388385
this.startTime = 0;
389386
this.previousTime = 0;
387+
388+
if (this.audio)
389+
{
390+
this.audio.pause();
391+
this.audio.dataset.used = 'false';
392+
this.audio = null;
393+
}
390394
},
391395

392396
/**

0 commit comments

Comments
 (0)