Example 4
This example loads multiple items into the playlist, WITH custom artist and title information, AND cover art and cover art link
The following link would be used in your page to trigger the loading.
<a href="javascript:;" onClick="wimpy_addMultipleTracks(true, Alist)">
Click here to load multiple tracks
</a>
And this is the code needed to set up the player and playlist:
<script language='javascript' src='wimpy.js'></script>
<div id="wimpyTarget">This DIV content will be replaced by Wimpy.</div>
<script language="JavaScript" >
// Render the player on the page:
makeWimpyPlayer("blank.xml");
// NOTE: If you just want to load the player without a start up track or playlist, you'll have to "trick" wimpy by referencing an XML file that doesn't exist, or references a playlist that doesn't have any <item>'s in it. If you reference an XML file that doesn't exist (as in this example) you may recieve 404 errors in your server logs, so referencing "real" file that doesn't have any <items> will eliminate server log entries.
// Create an Array that contains playlist. Each index of the array houses an Object.
Alist = Array();
// Establish and empty object:
var temp = new Object();
// Populate the object with varibles refering to each kind of data.
temp.filename = "example1.mp3";
temp.artist = "Artist One";
temp.title = "Track One";
temp.visual = "example1.jpg";
temp.link = "http://www.wimpyplayer.com";
// Add the object tot eh end of the array
Alist[Alist.length] = temp;
// The model above is replicated for additional playlist items:
var temp = new Object();
temp.filename = "example2.mp3";
temp.artist = "Artist Two";
temp.title = "Track Two";
temp.visual = "example2.jpg";
temp.link = "http://www.wimpyplayer.com";
Alist[Alist.length] = temp;
var temp = new Object();
temp.filename = "example3.mp3";
temp.artist = "Artist Three";
temp.title = "Track Three";
temp.visual = "example3.jpg";
temp.link = "http://www.wimpyplayer.com";
Alist[Alist.length] = temp;
var temp = new Object();
temp.filename = "example4.mp3";
temp.artist = "Artist Four";
temp.title = "Track Four";
temp.visual = "example4.jpg";
temp.link = "http://www.wimpyplayer.com";
Alist[Alist.length] = temp;
</script>