I want to play a sound starting at a specific timestamp. But I canโt even get the simplest example to work correctly. I tried the following and also modified the w3school 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 each browser has different sounds: Chrome for Windows will be 4 seconds late, Chrome for Android seems to be in place, Mobile Safari is disabled. (Even if VLC has this problem when playing a file.) If playback starts from the beginning of the file, they remain in sync.
So, it seems to me that the HTML5 audio standard is either improperly implemented or poorly explained.
I read that server-side is sometimes to blame, but I'm not sure how this will be a problem when reading local files. Ultimately, I want this work to work on a project in Cordoba.
Any ideas?
javascript html5 cordova audio
Chris backofen
source share