amites Posted February 18, 2009 Share Posted February 18, 2009 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 Quote Link to comment Share on other sites More sharing options...
gizmola Posted February 18, 2009 Share Posted February 18, 2009 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 Quote Link to comment Share on other sites More sharing options...
amites Posted February 18, 2009 Author Share Posted February 18, 2009 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 Quote Link to comment Share on other sites More sharing options...
gizmola Posted April 14, 2009 Share Posted April 14, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.