Skip to content

Commit 999b7d9

Browse files
skipping looping and ending logic if current time is 0 since some HTML5 Audio implementations set currentTime value to 0 when changing playback rate or performing any other operation on an audio tag object
1 parent f7b0dcf commit 999b7d9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,17 @@ var HTML5AudioSound = new Class({
213213
}
214214
return;
215215
}
216+
var currentTime = this.audio.currentTime;
217+
// skipping looping and ending logic if current time is 0
218+
// since some HTML5 Audio implementations set currentTime
219+
// value to 0 when changing playback rate or performing any
220+
// other operation on an audio tag object
221+
if (currentTime === 0) {
222+
return;
223+
}
216224
// handle looping and ending
217225
var startTime = this.currentMarker ? this.currentMarker.start : 0;
218226
var endTime = startTime + this.duration;
219-
var currentTime = this.audio.currentTime;
220227
if (this.currentConfig.loop) {
221228
if (currentTime >= endTime - this.manager.loopEndOffset) {
222229
this.audio.currentTime = startTime + Math.max(0, currentTime - endTime);

0 commit comments

Comments
 (0)