What is a playlist?

A "playlist" is a general term for set of files which are displayed together or in sequence by a Flash player. It could be a list of videos, MP3s, images, or a mix of these. Within SWF Tools they take the form of a general structured list of data that will eventually find its way into an XML file.

Displaying a list of files as a playlist

SWF Tools provides a useful function for generating playlist data: swftools_prepare_playlist_data(). This is really useful for quick results where you have a list of files and you just want to push them out. Once you have your playlist data, you can then pass it to a variation of the swf() function called swf_list().

// Generate some playlist data which is compatible with SWF Tools.
$playlist =  swftools_prepare_playlist_data(array('image1.jpg', 'image2.jpg'));

// Pass the playlist data to the playlist display function.
print swf_list($playlist);

// REMEMBER, that swf_list bahaves like swf(), so you can
// do all the same tricks with flashvars and params.
print swf_list($playlist, '400x300');

Note - as of SWF Tools 6.x-2.0 it is not necessary to call the prepare function separately. Just call swf() directly with an array of files, and SWF Tools will take care of everything automatically.

So

$files = array('image1.jpg', 'image2.jpg');
print swf($files);

Will work fine.