RE: More Streaming Woes....

"Rob Sarten" <[email protected]> Tue, 20 Aug 2002 15:42:35 +1200
Newsgroups gmane.comp.apache.mod-mp3
Message-ID <001001c247fb$a16d6660$8600000a@homer>
Hi,

Here are some modifications i have made to Ampache along similar lines. Added some extra stuff to stop IE caching the playlists as i had problems with selecting different albums and listening to the previous one or others because IE was lazy and pulled the playlist straight from cache.


This was originally playlist.m3u... but i have since changed it to m3u.php because i think the original setup was rather odd.. ;-)


require('../modules/config.php');

// kludge alert ... have to set this because IE is dumb (see php.net and search
//  for session_cache_limiter in the function reference
file://session_cache_limiter('nocache');
check_session($ampache_session);

header("Content-Type: audio/mpegurl;");
header("Content-Disposition: inline; filename=\"playlist.m3u\""); 
header("Expires: 0"); 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header("Pragma: nocache"); 

And some changes to make the playlists nicer to view with a text editor on windows systems..

echo "#EXTM3U\r\n";
while (list ($index, $s) = each ($songs)) {
  $si = get_song_info_from_md5($s); 
  $artist = get_artist_name($si->artist);
echo "#EXTINF:$si->time,$artist,$si->title\r\n";
file://echo "http://$settings[w_host]/play.php?song=$s&uid=$user_id\r\n";
echo "http://$settings[m_host]/?op=play&song=$s\r\n";


Works very well now..

-Rob