I am working with jQuery mobile and using the HTML5 audio tag. I have a single button to trigger the playing of the audio on the page. I trigger the audio playback with the following:
$('#voice').live("click", function() {
$('#speech').trigger("play");
});
The audio tag is simple:
<audio src="path_to_media" id="speech"></audio>
When a page is first loaded the audio works perfectly however the audio tag and source on not updated on page transition, so going to another page with different audio and clicking play will play the same audio file as the first page unless of course I manually refresh the browser. Is there any way around this?
Can’t specify your problem exactly however I’ve done exactly the same thing here: http://blog.colourbomb.net/?p=193
It performs fine on Desktop and iPhone but on Android I see the same behaviour you have, one solution is to delete the audio tag from the DOM, then create a new one and inject it giving you a new instance of an audio object that should be reset. Which platform are you seeing the issue on, do you get it happening in a desktop browser too?