I want to play audio starting at a specific timestamp. But I can't even get the simplest example to work right. I tried the following, and also modifying w3school's example.
<body>
<audio src="skyfall.mp3" id="audio" controls preload></audio>
<button onclick="play()">Play</button>
</body>
<script type="text/javascript">
var secs = 32;
function play(){
var p = document.getElementById("audio");
p.currentTime = secs;
console.log('Playing at secs: ' + secs);
p.play();
}
</script>
But different audio plays on each browser: Chrome for Windows is about 4 seconds late, Chrome for Android seems spot-on, Mobile Safari is off. (Even VLC has this issue when playing the file.) If playback starts from the beginning of the file, they stay in sync.
So it looks to me like the HTML5 audio standard is either incorrectly implemented or poorly explained.
I've read that server-side support is sometimes to blame, but I'm unsure how this would be an issue when I'm reading local files. Ultimately I want to get this working in a Cordova project.
Any ideas?