PDA

View Full Version : [WIP] wmpcontrols.js



timROGERS
25-03-2007, 10:17 AM
I've just quickly built a Javascript file with some functions for controlling Windows Media Player. I can't promise that it will work, as I don't have a shoutcast of my own, but I think it will - could some people try it and then tell me whether it works? If it doesn't, please tell me what is in your browsers error log :P

It's easy to intergrate into your page. First, add a Windows Media Player control and give it any id you want. Next, download wmpcontrols.js (http://www.tim-rogers.co.uk/wmpcontrols.js), put it in the same place as your page and then add the follow code to the head tag of your page:



<script type="text/javascript" src="wmpcontrols.js" />


Next, you must give the Javascript the ID of your player control. Add the following code within your head tags, this time replacing yourid with the ID of the control.



<script type="text/javascript">
window.OnLoad = definePlayer('yourid');
</script>


Now you have done that, you can use any of the three method functions to take control of the player, which are pausePlayer(), stopPlayer(), and playPlayer(). For example you could have a link like this:



<a href="#" onClick="playPlayer()">Play</a>

F32
25-03-2007, 10:19 AM
Looks good Mr.Tim.

I cannot try it out though as of yet :P

Want to hide these adverts? Register an account for free!