Remote API

Starting as a pure remote control library now the WebPlayer JavaScript API enables the user to dynamically create WebPlayer instances and control them. Soon it will be possible to get notified about events happening inside the WebPlayer (e.g. player proceeded to next entry, etc.).

The remote chapter gives a short tutorial how you can remote control the WebPlayer. Our download section describes how the get the library. The following pages describe in detail all features of our WebPlayer JavaScript API. Please note that the Vanadium class is located inside the org.webminster object (package). To shorten the following description those package name has been left out.

Vanadium()

Constructor. Creates a javascript instance of the WebPlayer. To insert the instance as a flash movie into your webpage use write(string sParentId). To change the default properties use the following constructor.

Vanadium(

string sBinarySrc, string sSrc, int iWidth, int iHeight,
string sAutoStart, string sLoop, string sRandom, string sPreviewPath,
string sRemoteCtrl, string sDebug, string sId)

Constructor. Creates a javascript instance of the WebPlayer using the given properties instead of the default values.
sBinarySrc:

Name of WebPlayer flash file "webplayer.swf"

sSrc:

Name of the file which has to be played by the WebPlayer. (MP3 or playlist)

iWidth:

Width of the WebPlayer within the web page

iHeight:

Height of the WebPlayer within the web page

sAutoStart:

Defines whether WebPlayer should automatically start to play the (first) song or not ("true" / "false")

sLoop:

Defines whether the WebPlayer should repeats to play the first playlist entry after all entries (of the playlist) have been played or not ("true" / "false")

sRandom:

Defines whether the WebPlayer should play the entries of the playlist in random sort order or not ("true" / "false")

sPreviewPath:

Path to preview image which should be displayed by the WebPlayer instead of the Player itself. As soon as the user clicks on the preview image the Player is displayed and (if autostart is set) starts to play the first playlist entry. An example can be found here (please select the Preset "WebPlayer Preview").

sRemoteCtrl:

Must be set to "true" if you want to remote control your WebPlayer

sDebug:

Must be set to "true" if you want to use the debugging features of the WebPlayer

sId:

Defines the id of your WebPlayer (flash movie) HTML tag, which will be created if you use the following write() function

void Vanadium.write(string sParentId)

Creates a HTML tag to embed the WebPlayer flash movie within your web page. The WebPlayer is embedded as a child of the HTML tag which has the id sParentId. The created HTML tag is automatically chosen correctly depending on the users browser type (we use SWFObject for this).

void Vanadium.setId(string sId)

Allow to set the id of the player, which has to be controlled.

void Vanadium.play()

Starts playing current playlist entry.

void Vanadium.pause()

Pauses playing current playlist entry.

void Vanadium.stop()

Stops playing current playlist entry.

void Vanadium.setPosition(int iPos)

Sets Position of current played entry to iPos (in ms).

void Vanadium.setVolume(int iVol)

Sets volume of current played entry to iVol (in %).

void Vanadium.incVolume(int iVol)

Increases volume of current played entry by iVol (in %).

void Vanadium.decVolume(int iVol)

Decreases volume of current played entry by iVol (in %).

void Vanadium.next()

Continues with the next song in playlist.

void Vanadium.prev()

Returns to the previous song in playlist or restarts current song if position of song is less than 4s.

void Vanadium.gotoEntry(int iEntryPos)

Proceeds to the iEntryPos-th playlist-entry.

void Vanadium.openInfoWindow()

Opens an info window displaying information about the WebPlayer.

void Vanadium.registerEventHandler(fEventHandler)

Registers the function fEventHandler (call event handler). The event handler is called every time an event occures within the WebPlayer. The event handler function must have on numeric parameter which contains the event type identifier. All event type identifiers are listed here.

void Vanadium.deregisterEventHandler()

Deregisters the currently registered event handler.