function swftools_flowplayer3_swftools_playlist_flowplayer3 in SWF Tools 6.3
Implementation of hook_swftools_playlist_PLAYER().
File
- flowplayer3/
swftools_flowplayer3.module, line 714 - Enables SWF Tools support for Flowplayer 3.
Code
function swftools_flowplayer3_swftools_playlist_flowplayer3(&$data) {
// Initialise array to hold data
$playlist = array();
// Initialise a stream counter and array of providers
static $stream_count = 1;
static $providers = array();
// Get current defaults for the player
$saved_settings = _swftools_flowplayer3_settings($data['othervars']['profile']);
// Get path to the empty image (used in conjunction with playlists)
$empty_image = base_path() . drupal_get_path('module', 'swftools_flowplayer3') . '/images/empty.gif';
// Get file paths out of the playlist_data array and add to Flowplayer playlist
foreach ($data['othervars']['playlist_data']['playlist'] as $play) {
// Check to see if there is an image
if ($play['image']) {
// Store the original image (unmodified by imagecache)
$original_image = $play['image'];
// If an imagecache preset is set we need to use a modified thumbnail
if ($saved_settings['imagecache']['imagecache_player'] != SWFTOOLS_UNDEFINED) {
$play['image'] = swftools_imagecache_create_path($saved_settings['imagecache']['imagecache_player'], $play['image']);
}
// Attach this thumbnail to the playlist
$playlist[] = '{ "url": "' . $play['image'] . '" , "autoPlay": true, "swftoolsThumb": true }';
// If we are also generating an HTML playlist, the playlist includes images, and we are using imagecache, then create the proper path
if ($saved_settings['playlists']['playlist'] && $saved_settings['playlists']['images'] && $saved_settings['imagecache']['imagecache_playlist'] != SWFTOOLS_UNDEFINED) {
$play['image'] = swftools_imagecache_create_path($saved_settings['imagecache']['imagecache_playlist'], $original_image);
}
}
elseif ($saved_settings['playlists']['playlist'] && $saved_settings['playlists']['images'] && $saved_settings['playlists']['fillemptyimages']) {
$play['image'] = theme('swftools_empty_image', $data);
}
// If this element is streamed then see if it is a new provider, and set the provider key on the play element
if ($play['stream']) {
if (!isset($providers[$play['stream']])) {
$providers[$play['stream']] = $stream_count++;
}
$play['provider'] = 'rtmp' . $providers[$play['stream']];
}
// Generate playlist element, already formatted to JSON
$element = theme('swftools_flowplayer3_playlist_element', $play);
// Attach this playlist element
$playlist[] = $element;
}
// Attach the completed playlist to flowplayer array
$data['othervars']['flowplayer3']['playlist'] = $playlist;
// Attach the list of stream providers
$data['othervars']['flowplayer3']['providers'] = $providers;
// Show we are not offering xml
return SWFTOOLS_NON_XML_PLAYLIST;
}