diff --git a/src/howler.core.js b/src/howler.core.js index afd8e6df..f6322524 100644 --- a/src/howler.core.js +++ b/src/howler.core.js @@ -756,6 +756,19 @@ playHtml5(); } else { var listener = function() { + + //It's possible stop or pause has been called in the meantime. + //Check this for looped sounds to avoid looping forever. + if (self._loop){ + for(var i = 0, len = self._queue.length; i < len; i++){ + var eventType = self._queue[i].event; + if(eventType === 'stop' || eventType === 'pause'){ + self.loop(false); + break; + } + } + } + // Begin playback. playHtml5(); @@ -2149,7 +2162,7 @@ // Create and expose the master GainNode when using Web Audio (useful for plugins or advanced usage). if (Howler.usingWebAudio) { Howler.masterGain = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain(); - Howler.masterGain.gain.value = 1; + Howler.masterGain.gain.value = Howler._muted ? 0 : 1; Howler.masterGain.connect(Howler.ctx.destination); }