howler.js
howler.js copied to clipboard
"duration" possibly not being set correctly in Howl.prototype.play
Hi,
I noticed that my audio sprites were playing past their specified endpoints and tracked it down to lines 343-344:
var pos = (node._pos > 0) ? node._pos : self._sprite[sprite][0] / 1000,
duration = self._sprite[sprite][1] / 1000 - node._pos;
They worked fine when I switched it to:
var pos = (node._pos > 0) ? node._pos : self._sprite[sprite][0] / 1000,
duration = self._sprite[sprite][1] / 1000 - pos; // "pos" instead of "node._pos"
...but I'm not sure if this has other ramifications as I haven't really examined the rest of the source. Would this cause issues elsewhere?
Ooch. Never mind. I didn't realize the second index in the sprite definition's array was the duration - I thought it was the end-time (it didn't help that the JSON output by audiosprite uses [start-pos, end-pos]).