Jump to content

Loading an MP3 file through php validation for streaming in flash


amites

Recommended Posts

has anyone here done this?

 

I have setup a program to validate that a user has access to a given mp3 file, from there they have the options of downloading it or listening to it through a flash player.

 

The download part works well using:

<?php
header("Cache-Control: public, must-revalidate");
header("Pragma: hack"); // WTF? oh well, it works...
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($file_path)) );
header('Content-Disposition: attachment; filename="'.$file_name.'"');
header("Content-Transfer-Encoding: binary\n");

readfile($file_path);

?>

 

however I have had one hell of a time getting it to load into a mp3 player, I figure it has something to do with the "Content-Transfer-Encoding" though I'm honestly in a bit over my head at this point.

 

any thoughts / advice / help / examples / etc...

 

thank you

Look into m3u files if you want to offer streaming of the mp3 files.  You need to configure your webserver to provide the correct mime type for files of that extension.  There's some nice nuts and bolts information on a variety of formats here:  http://www.spartanicus.utvinternet.ie/streaming.htm

not certain that "streaming" is the right word,

 

I am trying to use a flash player that is designed to access mp3 files through a common directory, given that these files are restricted I want to verify access before playing...

 

guess I'll keep tinkering

  • 1 month later...

not certain that "streaming" is the right word,

 

I am trying to use a flash player that is designed to access mp3 files through a common directory, given that these files are restricted I want to verify access before playing...

 

guess I'll keep tinkering

 

Ok, well that is certainly doable, but you will need to create your flash application and handle all the security stuff in there.  As this is no longer a PHP question per se, I'd have to recommend you look into some actionscript. 

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.