howler.js
howler.js copied to clipboard
support timeupdate event ?
The timeupdate event is fired when the time indicated by the currentTime attribute has been updated.
+1 This would be useful.
The audio demo player uses something like this:
audio = new Howl({
src: url,
onplay: function () {
requestAnimationFrame(step.bind(this);
}.bind(this)
};
function step() {
var self = this;
// Get the Howl we want to manipulate.
var sound = self.playlist[self.index].howl;
// Determine our current seek position.
var seek = sound.seek() || 0;
timer.innerHTML = self.formatTime(Math.round(seek));
progress.style.width = (((seek / sound.duration()) * 100) || 0) + '%';
// If the sound is still playing, continue stepping.
if (sound.playing()) {
requestAnimationFrame(self.step.bind(self));
}
},
The issue with this is that it uses requestAnimationFrame which is only fired when the tab is active. For your audio player demo this wont be an issue because you use this to show real time progress bar, but for my case i need to manipulate the audio. Thus right now if user switches tabs in my software the audio goes out of sync with the rest of items on my website causing issues. Please add support for this, thank you.
this should be part of the functionality.
It would be pretty useful feature. Please add
+1
Any updates on that issue?
@hamzawain7. Solution with requestAnimationFrame
is pretty good. That is the base of my progress bar implementation. Thanks!