Skip to content

Instantly share code, notes, and snippets.

@etianen
Created April 14, 2014 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etianen/10652311 to your computer and use it in GitHub Desktop.
Save etianen/10652311 to your computer and use it in GitHub Desktop.
$("#your-button").click(function() {
// Remove the old audio tag.
$("#your-audio-container").find("audio").remove()
// Add a new audio tag in.
$("#your-audio-container").append($("<audio/>", {
src: "new-audio-file.mp3",
controls: true,
preload: true
}));
// Apply the html5media shim on legacy browsers.
html5media();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment