RE: More Streaming Woes....

"Disnard, Jon" <[email protected]> Mon, 19 Aug 2002 09:13:58 -0400
Newsgroups gmane.comp.apache.mod-mp3
Message-ID <[email protected]>
Howdy,


I can see immediately that the stuff your sending in the header()
function is incorrect.

  header("Content-Type: audio/mpegurl;");
  header("Content-Disposition: attachment; filename=playlist.m3u");

Look again, and notice that the 'Content-Type: audio/mpegurl;' should
not contain a ';' (semi-colon) character.
Here is an example of php code that demonstrates the same idea, taken
from Mummi:


<snip>

$plst_string .= "#EXTM3U\n";
while(list($key, $val) = @each($plst_array)){
	$plst_info = $adb->pull_plst_info($val);

	if($plst_info[seconds]) $seconds = $plst_info[seconds];
	else $seconds = "-1";

	if($plst_info[id3v1_title]) $title = $plst_info[id3v1_title];
	elseif($plst_info[id3v2_title]) $title =
$plst_info[id3v2_title];
	else $title = "Untitled";

	if($plst_info[id3v1_artist]) $artist = $plst_info[id3v1_artist];
	elseif($plst_info[id3v2_artist]) $artist =
$plst_info[id3v2_artist];
	else $artist = "Unknown Artist";

	// if the id3 tag is present, we test it for title, and artist
fields.
	if(($plst_info[id3v1]) || ($plst_info[id3v2])){
		$plst_string .= "#EXTINF:$seconds,$artist - $title\n";
	}else{
		// the filename will be used.
		// trim the .mp3 or .ogg extension off the file.
		$plst_info[filename] =
eregi_replace(".$plst_info[file_type]", "", "$plst_info[filename]");
		$plst_string .=
"#EXTINF:$seconds,$plst_info[filename]\n";
	}
	$plst_string .=
"$GLOBALS[stream_url]:$GLOBALS[stream_port]/?op=play&song=$val\n";
}//eo while
header("Content-Disposition: attachment;
filename=$session_array[user_name].m3u");
header("Content-Type: audio/mpegurl");
echo "$plst_string";

</snip>


As you can see, I actually place the content-disposition before the
content-type, but I'm fuzzy on why I did that.
I recall it had something to do with the same situation your having now.
The above code works on just about ever environment I've tested. I hope
it helps. =)


-Jon


-----Original Message-----
From: Jon Buda [mailto:[email protected]] 
Sent: Sunday, August 18, 2002 02:19
To: [email protected]
Subject: [Mod_mp3] More Streaming Woes....


hello all,

So I redid the playing part of my server and then asked some people in 
IRC to check it out.  It works fine for me with XMMS and Mozilla 1.0 in 
Linux, but people using windows were having trouble.   One person was 
using IE6 and winamp and had the audio/mpegurl type associated with 
winamp.   When he went to play something IE prompted to save or open the

playlist.  if he did open, winamp came up but the playlist was empty. 
 if he saved it to disk and then opened it, it worked fine.  Also, 
another person used IE and windows mediaplayer and said when he hit 
play, windows media player said it couldnt find the file.  

Anyone experienced any of these problems before?  I havent been able to 
test the IE/winamp combo yet because the site is locally on my linux 
partition.

Heres an example of the code to play:
elseif($play == "playlist"){
  header("Content-Type: audio/mpegurl;");
  header("Content-Disposition: attachment; filename=playlist.m3u");
  $query = "SELECT t2.signature,t2.length,t2.name,t2.artist FROM 
server_playlist as t1, server_music as t2 WHERE t1.music_id=t2.id AND 
user_id=$_SESSION[sess_userid] ORDER BY t1.id";
  Connect();
  $tmp = "#EXTM3U\n";
  $result = mysql_query($query);
  while($row = mysql_fetch_array($result)){
    $tmp .= "#EXTINF:$row[length],$row[name] - $row[artist]\n";
    $tmp .= 
"http://$GLOBALS[http_server]:8000/?op=play&song=$row[signature]\n";
  }     
  echo $tmp;
  exit;   
}    

Jon Buda
hopefully I have something up soon for everyone to take a look at thanks
all

_______________________________________________
Mod_mp3 mailing list
[email protected]
http://lists.tangent.org/mailman/listinfo/mod_mp3