My current implementation of MP3 audio playback works great, however in Chrome on an Android device there is a delay between the 'canplay' event being triggered (which starts a visual playback progress bar) and when the audio is actually heard through the device. This results in the visual progress bar being out of sync slightly.
Is there a more reliable way of detecting when audio playback commences than using 'canplay'?
My logic is as follows:
var audio = new Audio();
audio.src = 'something.mp3';
audio.play();
audio.addEventListener('canplay', function() {
// audio playback commences now.
// start progress bar animation.
});