To find out, what can be done using the remote control functionality of the WebPlayer, just have a look at http://test.vanadium.webminster.org. In the left bottom corner of the page you can find a simple example of a WebPlayer remote control. While the player is running, you are able to control the WebPlayer completely just by using the control buttons.
Technically those buttons use the WebPlayer JavaScript library (libvanadium.js) to control the WebPlayer. To use this library you have to download our latest WebPlayer release and include the JavaScript library into your webpage.
After including the library your webpage should look something like:
<html>
</html>
Well now you have a running WebPlayer on your webpage. To remote control it you have to create an instance of a javascript class called Vanadium. To tell javascript which player you want to control (you probably have multiple on your page) you have to bind the instance to the flash movie by using the id myPlayer. The following line show how easy that is:
//Create WebPlayer javascript instance
var myWebPlayer = new org.webminster.Vanadium();
//Bind instance to flash movie which has the id "myPlayer"
myPlayer.setId("myPlayer");
//Control the player as you like
myPlayer.play();
myPlayer.pause();
myPlayer.setVolume(30);
myPlayer.play();
The documentation of the WebPlayer JavaScript API extensively describe the whole API.
Another very useful feature of the WebPlayer library is the write() function. It enables you to insert a WebPlayer flash movie in your webpage by just calling a javascript function. By the way our testpage uses exact this functionality when you press the "Go" Button.
Similar to the above example you have to create an instance by calling var myWebPlayer = new org.webminster.Vanadium(...). To change the default properties of the player you can parameterize the call. To insert the WebPlayer now just call myWebPlayer.write("playerDiv"). In this case the WebPlayer will be inserted into the HTML tag which has the id "playerDiv".
By the way, the insertion is done using the SWFObject library. It guarantees that the WebPlayer flash movie is always included within your homepage appropriate to your visitors browser.
The following example shows, how to insert the WebPlayer using javascript:
//Create WebPlayer javascript instance
var myWebPlayer = new org.webminster.Vanadium("webplayer.swf", "playlist.xspf", 280, 64, true, true, false);
//Bind instance to flash movie which has the id "myPlayer"
myPlayer.setId("myPlayer");
//Insert WebPlayer into webpage as child of HTML element having id "playerDiv"
myPlayer.write("playerDiv");