Dynamic .asx and .ram playlist with .php extension

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
keenlearner
Forum Commoner
Posts: 50
Joined: Sun Dec 03, 2006 7:19 am

Dynamic .asx and .ram playlist with .php extension

Post by keenlearner »

Hello, I am trying to create a dynamic playlist using php and mysql. I used the header Content-Type: video/x-ms-asf to ask the browser to open the content using windows media player, will this work all the time ? and also do you know what is the mime type or content-type for real one video ?

the below code is cotained in the file such as http://www.example.com/playlist.php
so user can request for certain video like this http://www.example.com/playlist.php?i=888

so if the

Code: Select all

<?php
require_once('database.php');
if(isset($_GET['i'])){
	$result = mysql_query('SELECT playerType, url FROM playlist WHERE id='.$_GET['i'],$db->connection) or die(mysql_error());
	if(mysql_num_rows($result) > 0){	
		$r = mysql_fetch_assoc($result);
		if($r['playerType'] == 'wmp'){
		header("Content-Type: video/x-ms-asf");
echo "
<ASX Version='3'>
<title>video name</title>
<ENTRY>
<REF HREF=".$r['url']."/>
</ENTRY>
</ASX>";
		}		

		else if($r['player'] == 'realOne'){
			header("Content-Type: "); // I am not sure what is the mime type for real one player.
			echo $r['url'];
		}
	}
}
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://filext.com/detaillist.php?extdet ... rch=Search

Provided the content-type is known to the browser in some fashion, it will generally work all the time.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

keenlearner wrote:mime type or content-type for real one video ?
For Real Player MIME type: video/vnd.rn-realvideo
Post Reply