JW Image Rotator
Image Rotator Playlist Files
The image rotator supports three commonly used playlist XML formats: XSPF (much used for CC music), RSS (much-used for Podcasts) and ASX (much-used on Windows servers). You can assign a playlist to the rotator with the file flashvar. Additional metadata items, like a title and link, can be set in a playlist as well.
Metadata items
Here is a complete overview of all metadata items and their corresponding XSPF, RSS and ASX tags:
| Item | XSPF | RSS | ASX |
| file | <location> | <media:content> | <ref> |
| id | <identifier> | <guid | <param name="id"> |
| link | <info> | <link> | <moreinfo> |
| type | <meta rel="type"> | <media:content> | <param name="type"> |
| title | <title> | <title> | <title> |
| author | <creator> | <author> | <author> |
Common pitfalls
Let's point out two common pitfalls users encounter when using playlists. First, always try to use full URL's (including the http:// part) when referring to files, links or images in your playlists. It will save you a lot of troubles with unresponsive SWF's or "file not found" errors! Nine out of ten times this is because the relative-url setup isn't working. Note that the Flash plugin checks for image and MP3 files relative from the HTML page!
Second, a playlist should always reside on the same server as the SWF file, due to security restrictions of the Flash Player. This can be solved if you own the domain on which the mediafiles reside. You then have to put a crossdomain.xml file in the root webfolder of that server. In this file, you can specifically allow sites to load data.
Auto generating
It's quite easy to autogenerate playlists serverside and then assign them to the player. You won't have to change the extension to .xml, since the player and rotator by default assume that the file flashvar is a playlist. Here's an example PHP script that autogenerates a playlist from MSQL:
// first connect to database
$dbcnx = @mysql_connect("localhost","USERNAME","PASSWORD");
$dbselect = @mysql_select_db("DATABASE");
// next, query for a list of titles, files and links.
$query = "SELECT title,file,link FROM mp3_table";
$result = mysql_query($query) or die('Error: '.mysql_error());
// third, build the playlist
header("content-type:text/xml;charset=utf-8");
echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
echo "<trackList>\n";
while($row = @mysql_fetch_array($result)) {
echo "\t<track>\n";
echo "\t\t<title>".$row['title']."</title>\n";
echo "\t\t<location>".$row['file']."</location>\n";
echo "\t\t<info>".$row['link']."</info>\n";
echo "\t</track>\n";
}
echo "</trackList>\n";
echo "</playlist>\n";
If this file is called playlist.php, you can simply state file=playlist.php in your flashvars, and the PHP file will be requested and executed. Note that there are a couple of excellent playlist generators out there and being discussed in the forum.
