I am using the Media Element JS to play some audio on my page. Works great but I would like to be able to have the audio play when a link is clicked, but I cannot figure out how to do this. Here is my code:
JS
$(document).ready(function() {
$('audio,video').mediaelementplayer();
});
HTML
<p>Element to Click to Trigger Audio Play</p>
<audio id="player2" src="path.mp3" type="audio/mp3" controls></audio>
Note: The audio player will be viewable, but due to the layout of the page I am provided an extra way (if possible) for the audio to be played.
Note: I must be able to trigger both HTML 5 player and the flash fallback player.
I found the solution in this Question and Answer while I kept search SO.
Solution: