Jump to content

Streaming ASX files


surfingtonio

Recommended Posts

im trying to serve .wma files through php. the code i have is this:

	session_start();

function createASXMarkup ($mediaURL, $media) {
	$source  = '<asx version="3.0">'."\n";
	$source .= '<entry>'."\n";
	$source .= '<title>title goes here..</title>'."\n";	
	$source .= '<ref href="'.$mediaURL.$media.'" />'."\n";	
	$source .= '<author>Authoer</author>'."\n";
	$source .= '<copyright>©2008 example.com</copyright>'."\n";
	$source .= '</entry>'."\n";
	$source .= '</asx>'."\n";
	return $source;
}

if ($_SESSION['logged']) {
	$mediaURL = 'http://example.com/';
	header('content-disposition: filename='.$_REQUEST['video']);
	header('content-type: video/x-ms-asf;');
	echo createASXMarkup ($mediaURL, $_REQUEST['video']);
} else {
	header ('location:login.php?video='.$_REQUEST['video']);
}

 

it properly redirects when user is not logged but it only gives a black media player window on firefox when the user is logged in.

 

if i remove the conditional checks:

 

	function createASXMarkup ($mediaURL, $media) {
	$source  = '<asx version="3.0">'."\n";
	$source .= '<entry>'."\n";
	$source .= '<title>title goes here..</title>'."\n";	
	$source .= '<ref href="'.$mediaURL.$media.'" />'."\n";	
	$source .= '<author>Authoer</author>'."\n";
	$source .= '<copyright>©2008 example.com</copyright>'."\n";
	$source .= '</entry>'."\n";
	$source .= '</asx>'."\n";
	return $source;
}

$mediaURL = 'http://example.com/';
header('content-disposition: filename='.$_REQUEST['video']);
header('content-type: video/x-ms-asf;');
echo createASXMarkup ($mediaURL, $_REQUEST['video']);

 

the stream works fine on both firefox and ie. i have no idea what's going on. please help!!! ???

Link to comment
https://forums.phpfreaks.com/topic/84608-streaming-asx-files/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.