Skip to content

Commit 602ce76

Browse files
fix(html5-playback): remove setTimeout() call that caused loss of call stack
On mobile, the play event needs to be triggered by a user gesture. By setting a timeout the call stack containing the user tap gesture is lost. Since this was added way back to support something in Firefox 13 it could most likely be removed without negative impact. #609
1 parent 96e8a96 commit 602ce76

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/howler.core.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -736,18 +736,16 @@
736736
node.volume = sound._volume * Howler.volume();
737737
node.playbackRate = sound._rate;
738738

739-
setTimeout(function() {
740-
node.play();
739+
node.play();
741740

742-
// Setup the new end timer.
743-
if (timeout !== Infinity) {
744-
self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
745-
}
741+
// Setup the new end timer.
742+
if (timeout !== Infinity) {
743+
self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
744+
}
746745

747-
if (!internal) {
748-
self._emit('play', sound._id);
749-
}
750-
}, 0);
746+
if (!internal) {
747+
self._emit('play', sound._id);
748+
}
751749
};
752750

753751
// Play immediately if ready, or wait for the 'canplaythrough'e vent.

0 commit comments

Comments
 (0)