Skip to content

Commit

Permalink
Send sound ID to play after loading
Browse files Browse the repository at this point in the history
Proper fix for #714
  • Loading branch information
goldfire committed Jun 9, 2017
1 parent 6625fc6 commit 7696380
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/howler.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,14 +658,18 @@
sprite = sound._sprite || '__default';
}

// If If the sound hasn't loaded, we must wait to get the audio's duration.
// If the sound hasn't loaded, we must wait to get the audio's duration.
// We also need to wait to make sure we don't run into race conditions with
// the order of function calls.
if (self._state !== 'loaded') {
self._queue.push({
event: 'play',
action: function() {
self.play(sprite, internal);
if (sound) {
sound._sprite = sprite;
}

self.play(sound ? sound._id : sprite);
}
});

Expand Down

0 comments on commit 7696380

Please sign in to comment.