If you can use HTML5, you should use the audio tag instead of the embed tag.
A JSfiddle exists here: http://jsfiddle.net/u6dbV/
<audio controls="controls" onpause="alert('Paused');" onended="alert('Ended');">
<source src="http://www.jameshilldigital.net/testpage/borg.ogg" type="audio/ogg" />
Your browser does not support the audio tag.
</audio>
This method also gets you a ton of awesome usage through the HTML5 Audio Tag's API:
http://html5doctor.com/native-audio-in-the-browser/
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio
If you're looking for a programmatic example, I have a little audio player here: https://github.com/daekano/beard/blob/master/app/js/beard.js