I am using Chrome. In my dev tools console, I tried the following:
Everything works as expected except last line. Why can\'t I set currentTime
I had the same problem, and the reason was missing headers on the mp3 file, like:
Content-Length, Content-Range, Content-Type
Why cant I set
currentTime
on it?
Could not reproduce currentTime
being set to 0
after setting to 10
. Is 18.mp3
duration less than 10
?
var request = new XMLHttpRequest();
request.open("GET", "/assets/audio/18.mp3", true);
request.responseType = "blob";
request.onload = function() {
if (this.status == 200) {
var audio = new Audio(URL.createObjectURL(this.response));
audio.load();
audio.currentTime = 10;
audio.play();
}
}
request.send();
jsfiddle http://jsfiddle.net/Lg5L4qso/3/