Skip to content

Commit

Permalink
Fix regression that broke simple play/pause usage
Browse files Browse the repository at this point in the history
Fixes #1102 by restoring the check for a single paused sound when calling `play`.
  • Loading branch information
goldfire committed Dec 19, 2018
1 parent f768964 commit d22ddcf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/howler.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,24 @@
} else if (typeof sprite === 'undefined') {
// Use the default sound sprite (plays the full audio length).
sprite = '__default';

// Check if there is a single paused sound that isn't ended.
// If there is, play that sound. If not, continue as usual.
if (!self._playLock) {
var num = 0;
for (var i=0; i<self._sounds.length; i++) {
if (self._sounds[i]._paused && !self._sounds[i]._ended) {
num++;
id = self._sounds[i]._id;
}
}

if (num === 1) {
sprite = null;
} else {
id = null;
}
}
}

// Get the selected node, or get one from the pool.
Expand Down

0 comments on commit d22ddcf

Please sign in to comment.