Jump to content

Secure Stream MP3


chasethemetal

Recommended Posts

HeyI am currently using jPlayer for an audio player on website. It's great easily customized HTML 5 / CSS audio player. My only issue with the whole thing is the location of the MP3's are visible in the code...What it looks like in the jQuery:MP3: http://www.website.com/song.mp3but what I think it should look like is...MP3: http://www.website.com/stream.php?song=song.mp3and in that php file it will link to media BEHIND the public_html folder... BUT the kicker is how can I make it so that a stream ONLY happens when that URL is being accessed via the jplayer.php file....My website is structured like so... Site.php -> Jplayer.php(sits in iFrame) inside Jplayer.php the stream.php.... So again a way that is someone where to point the browser to http://www.website.com/stream.php?song=song.mp3 it would NOT work, ONLY if http://www.website.com/stream.php?song=song.mp3 is accessed via jplayer.php.I dont know I'm in a real rut... Any idea on how to make a secure streaming music player link that doesn't use flash...

Link to comment
Share on other sites

The first step is to set up the links like you want, and have that page print out the request information so that you can look for differences between a request for the player and a direct request. Enable error logging in the file, make sure that it has permission to write to the log file, and then log the $_SERVER array and compare the two requests for differences that you can check for to determine if it was a direct request or if it was for the player.

<?phpini_set('log_errors', 1);ini_set('display_errors', 0);ini_set('html_errors', 0);error_reporting(E_ALL);ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log');error_log(print_r($_SERVER, true));?>

That will direct errors to a file called error.log in the same directory as the script, and print the contents of the $_SERVER array in that log. Make sure PHP has permission to create and modify files in that directory. Access that script both ways and look for differences that you can check for.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...