From b30996997abbff6a1d36160f16a731e933e8a9b1 Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Tue, 25 Oct 2016 16:43:03 -0400 Subject: [PATCH] better handling for sounds that did not load --- src/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index aa920da..e351695 100644 --- a/src/index.js +++ b/src/index.js @@ -71,9 +71,11 @@ AudioEngine.prototype.playSound = function (index) { } else { // if the sound has not yet loaded, wait and try again log.warn('sound ' + index + ' not loaded yet'); - setTimeout(function () { - this.playSound(index); - }.bind(this), 500); + if (player) { + setTimeout(function () { + this.playSound(index); + }.bind(this), 500); + } } };