Skip to content

Commit e5f3429

Browse files
committed
Make sure seek and duration are >= 0 on play
1 parent c44bd39 commit e5f3429

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/howler.core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,8 @@
674674
}
675675

676676
// Determine how long to play for and where to start playing.
677-
var seek = sound._seek > 0 ? sound._seek : self._sprite[sprite][0] / 1000;
678-
var duration = ((self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000) - seek;
677+
var seek = Math.max(0, sound._seek > 0 ? sound._seek : self._sprite[sprite][0] / 1000);
678+
var duration = Math.max(0, ((self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000) - seek);
679679
var timeout = (duration * 1000) / Math.abs(sound._rate);
680680

681681
// Update the parameters of the sound

0 commit comments

Comments
 (0)