Media player in APEX
Quite a long time ago I made a collection of MP3s available from our APEX website and made them playable within the browser using Google’s shockwave player, using code like this:
<embed type="application/x-shockwave-flash" flashvars="audioUrl=#FILE_URL#" src="/3523697345-audio-player.swf" width="400" height="27" quality="best"> </embed>
This relies on the user’s browser being able to run flash applications. It looked like this:
With HTML5, however, this is no longer required, so I’ve updated it to:
<audio controls preload> <source src="#FILE_URL#" type="audio/mpeg"> </audio>
Not only is it simpler and no longer requires flash, it looks much nicer as well:
Note: you may or may not want to include the preload
tag, especially if you have more than one audio control on a page.