Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.