Block browser access to files on server
February 24, 2012 10:23 AM   Subscribe

How can I block browser access to MP3 files, yet allow streaming?

I run a music blog and often labels send us MP3s to stream on our blog. I upgraded our media player, but I noticed that as a Javascript fallback, the 'play' button links directly to the MP3. This is not okay!

Is there a way I can block direct access to the MP3s but allow streaming on my site? The MP3s are located at files.mysite.com and my blog is at mysite.com

Last, is there a way to achieve this on a per-file basis?
posted by ascetic to Computers & Internet (4 answers total) 1 user marked this as a favorite
 
You can always get around 'streaming-only' flash players to get the file directly, nothing you can really do about that, and I doubt that most labels care.
posted by empath at 10:31 AM on February 24, 2012


You can obfuscate it using Flash and some backend scripting, if you want to put together a flash interface. But of course, that won't work on many mobile devices.

Otherwise, it's challenging. Usually the only real difference between a browser streaming an MP3 and downloading an MP3 is that it deletes the file from the cache after it is done streaming instead of renaming it and putting it in your downloads folder.
posted by Jairus at 10:31 AM on February 24, 2012 [1 favorite]


Most "streaming" audio files are not actually streams but rather progressive downloads. And since it's a download, there's no real way to prevent the user from grabbing it. What you need is an RTMP server, such as Adobe Flash Media Server, that can stream files to Flash. Of course, there are already stream recorder apps for this protocol, but at least users can't just go fish the file out of their browser cache.
posted by kindall at 10:54 AM on February 24, 2012 [1 favorite]


This is something of a futile exercise due to reasons mentioned in previous answers. The data is being sent to the client either way. The best you can hope for is obfuscation. I don't know anything about your media player but maybe there's some way to disable the fallback?
posted by melt away at 11:53 PM on February 24, 2012


« Older Take me beyond Wikipedia!   |   N900 Repair Advice Newer »
This thread is closed to new comments.