I'm testing a page that plays music and displays lyrics at the same time. But I cannot for the life of me find any websites that detail media control through javascript...html...whatnot. Everything related to media on webpages seems extremely elementary and not helpful.

Currently I'm having a great deal of trouble having the music synchronize with javascript events. Here's some sample code:
<embed src="player.mp3" autostart="true" loop="false" hidden mastersound></embed>
<script type="text/javascript">
window.onload = load;
function load() { setTimeout("sing(0)", 4700); }

One would expect the browser to take into account the music loading before it started the timer, but it doesn't. Are there better media objects to use to ensure that the music and the sing() function begin when I want them to? Any help would be greatly appreciated.