Skip to content

Commit f5f5edc

Browse files
committed
Improve the running detection on play
Better fix for #664 that avoids a different regression.
1 parent 0dbf1cf commit f5f5edc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/howler.core.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -726,12 +726,13 @@
726726
}
727727
};
728728

729-
var isRunning = (Howler.state !== 'suspended');
729+
var isRunning = (Howler.state === 'running');
730730
if (self._state === 'loaded' && isRunning) {
731731
playWebAudio();
732732
} else {
733733
// Wait for the audio to load and then begin playback.
734-
self.once(isRunning ? 'load' : 'resume', playWebAudio, isRunning ? sound._id : null);
734+
var event = !isRunning && self._state === 'loaded' ? 'resume' : 'load';
735+
self.once(event, playWebAudio, isRunning ? sound._id : null);
735736

736737
// Cancel the end timer.
737738
self._clearTimer(sound._id);

0 commit comments

Comments
 (0)