I'm trying to use HTML5's audio controls and inject a dynamic path into the audio source, using JavaScript/jQuery.
Here's my markup:
<audio id="marker" controls>
<source src="placeholder.mp3" type="audio/mp3">
</audio>
and here's my attempt to overwrite the placeholder source:
var audio = $('#marker');
audio.src(path.mp3);
My expected result is that I can use the audio controls to play the audio located at path.mp3
, but instead the audio controls are greyed out, and it plays nothing.
Any ideas?