xspf/php
Advanced Usage

Back from whence you came...

This package was written to be flexible. The intent is that once installed you only need to update your xspf.dir file and manage content. Below are a few ideas that can make managing an embedded player very easy.

Info element.
As of 03/22/2009 the svn package contains an info and link element update. An info element can in included in a playlist on a per-directory basis by simply adding the URI to the end of the directory line in xspf.dir. The URI will be encoded so you can probably successfully cut and paste an address bar reference. The examples page uses this new playlist with an info link. Go ahead, click on the info button under the image. To enable info and link elements in the output see xspf.settings.php. They are disabled by default.

Note: Version 0.14 contains an option to allow direct download of a file using the info link. See "readme".

Cross Domain serving of files.
I maintain two domains and they both have some of the same music files on them. To spread the bandwidth usage across them I use a custom xspf.dir to scan files on one server while generating URL's that point to another. As an example, note the usage of a url that referes to a different server in red. This makes it possible to tell xspf.php the domain name upon which the duplicate music files are located.

Example of crossdomain references with info link:

#Example custom xspf.dir
----[path]------------ ----[url]-----------------------  ----[info link]----------------
/serverdirectory/BRMC/ http://yourdomain.net/BRMC/       http://mydomain.com/infolink/
/serverdirectory/pink/ http://yourotherdomain.org/pink/  http://PINKdomain.com/infolink/
# EOF

In the setup above, because the actual music player is an adobe flash (.swf) file the flash player that loads the swf on the client browser may not be able to access files (your music) outside the domain from which the .swf file itself was requested. To overcome this you'll need a "crossdomain.xml" file on the server containing the actual mp3 files to successfully satisfy a crossdomain request. This is a security limitation of the flash plugin. It has nothing at all to do with this playlist generator. Below is a simple crossdomain.xml example that allows public access to all files on the server when placed in the server root. You can copy and save it as-is, upload it to your music server and allow public access to all your mp3 files.

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "
http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

More information on crossdomain file access via flash is available at Adobe's site here: http://kb2.adobe.com/cps/142/tn_14213.html

All my source files are available individually if you don't want to use svn or don't know how. These are usually the latest copies but beware, sometimes I goof up while testing scripts and save a copy of the source before I notice a problem. You have been warned.

original.xspf.settings.phps
xspf.phps
xspf.autogen.phps
timer.class.phps <- depricated, use current xspf.autogen.php above
player.phps
player.ini

Enjoy the music!

siggma [at] trbailey.net