PKL_AddPlayer()

Description

Adds a new player to the web page. See "Player Options" for explanation on the available options.

Usage

PKL_AddPlayer(DataObject:Object) :Void

Parameters

DataObject:Object - An Object, or JSON containing the following values:

- media
- startuptext
- timeformat
- autoplay
- image
- artist
- title
- album
- controls
- classname
- id
- target

See "Player Options" for explanation on the available options.

Returns

Nothing

Example Code

<script language="javascript">

PKL_AddPlayer( { id: 'MyPlayer1', media: 'track.mp3', image: 'poster.jpg' } );

</script>

Using an Object instead of JSON

<script language="javascript">

var MyData = new Object():
MyData.media    = "MyPlayer1";
MyData.media    = "track.mp3";
MyData.image    = "poster.jpg";
PKL_AddPlayer(MyData);

</script>

 

By default, new players are appended to the bottom of the HTML page. Pickle player HTML code consists of a series of <DIV> tags. When a new player is created, new <DIV> nodes are appended to the bottom of the <BODY> of the page.

The "target" option is used, to render the newly created player into the target DIV.

<div id="MyTargetDiv">Pickle Players will appear in this div<br></div>

<script language="javascript">
   PKL_AddPlayer( { target: 'MyTargetDiv', id: 'MyPlayer1', media: 'track.mp3', image: 'poster.jpg' } );
</script>

 

The "classname" option is used to assign the newly created player a CSS rule -- allowing furthur control over positioning.

<script language="javascript">
   PKL_AddPlayer( { classname:'MyCSSrule', id: 'MyPlayer1', media: 'track.mp3', image: 'poster.jpg' } );
</script>

 

You can use both "target" and "classname", or one or the other.