You are here

function swftools_wijering_mediaplayer_playlist in SWF Tools 6

Same name and namespace in other branches
  1. 5 wijering/wijering.module \swftools_wijering_mediaplayer_playlist()

File

wijering/wijering.module, line 228

Code

function swftools_wijering_mediaplayer_playlist($xml_data, &$method, &$vars) {
  $xml = '<playlist version="1" xmlns="http://xspf.org/ns/0/">
            <title>' . $xml_data['header']['title'] . '</title>
            <info></info>
            <annotation></annotation>
            <trackList>
            ';
  foreach ($xml_data['playlist'] as $track => $details) {
    if (!isset($details['background']) && strtolower(substr($details['fileurl'], -3, 3)) == 'mp3') {
      if (isset($vars->flashvars['image'])) {
        $details['background'] = swftools_get_media_url(swftools_get_media_path() . $vars->flashvars['image']);
      }
      else {
        $details['background'] = SWFTOOLS_DEFAULT_BG;
      }
    }
    $xml .= "<track>\n";
    $xml .= "<title>" . $details['title'] . "</title>\n";
    $xml .= "<creator></creator>\n";
    $xml .= "<location>" . $details['fileurl'] . "</location>\n";
    $xml .= "<image>" . $details['background'] . "</image>\n";
    $xml .= "<info>" . $details['fileurl'] . "</info>\n";
    $xml .= "</track>\n";
  }
  $xml .= '</trackList>
           </playlist>';
  return $xml;
}