Hi there, I apologise in advance if my question seems a bit misleading, but I'm trying to wrap my head around this one.
I have a flash-based MP3 player (http://blog.lacymorrow.com/projects/xspf-jukebox) that exposes a Javascript API that is really handy for my situation. I am using jQuery and swfObject to embed the Flash player and that works well.
Now the player has auto-resume and auto-play functions that cause it to immediately start playing when the page is loaded, which is great. However, what I am trying to do is STOP the player when a certain page is browsed to. For instance, when I browse to contact.html, I want the player to stop playing any music. I had thought that the following would work:
$(function($) {
window.document.myJukebox.stopTrack();
});
I then remembered that everything inside $(document).ready()
or $(function($) {})
will execute as soon as the DOM is loaded BUT before all page contents are loaded. What I need to do is ensure that the above script runs without any user intervention once the entire page is fully loaded --> this is what I am stuck with and need your help with, please. If I have the following hyperlink on the page:
<a id="player-stop" href="javascript:window.document.myJukebox.stopTrack();">Click to Stop</a>
and click it, then the player does stop, so its clear to me that I need to have something that runs automatically without the user having to click on a STOP button. I have tried running this in a script at the bottom of the page with no luck.
Thank you!