Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check sound status before playHtml5() #714

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/howler.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);
}

Expand Down