I am setting an Audio element's currentTime = 0
, but it always emit the audio ended
event, and currentTime
is always equal to the duration.
audio.addEventListener('loadedmetadata', (e) => {
const that = this;
const audio = this.oAudio;
const duration = audio.duration;
if (duration === Infinity) {
audio.currentTime = 1e101;
audio.ontimeupdate = function() {
audio.ontimeupdate = () => {
};
audio.currentTime = 0;
that.duration();
};
}
}, false);