Reputation: 1147
How can I provide HTTP range header in src element of HTML5 element? I need to point audio element to source audio from byte offset X.
Upvotes: 2
Views: 550
Reputation: 4370
Rather than specifying byte offset, you can change currentTime
value of your audio
element.
The value should be a real number in unit of seconds;
var url = "your/audio/path.mp3";
var audio = new Audio(url);
audio.addEventListener("play", function() {
audio.currentTime = 10; // jump to 00:10
});
audio.play();
It will make browser to jump to certain position of audio, requesting with HTTP range header as necessary.
Upvotes: 1