I don't want to let my visitors download or see the path to my audio files. Is there a way to block this so the user doesn't see it?
-
1You could set it dynamically via JavaScript, but at best that will be obfuscation. Even then, something like Fire Bug will make it trivial to grab the path. – Kitsune Feb 25 '12 at 00:08
-
Yeah that doesn't take care of the problem! – Roozbeh15 Feb 25 '12 at 00:12
-
see here http://stackoverflow.com/questions/9222532/protect-audio-file-from-being-downloaded-while-still-being-playable-through-jque – Lloyd Feb 29 '12 at 21:26
4 Answers
I ended up using a PHP file to fetch the mp3 file. This way the path to the actual file remains hidden.
I understand that there's no way to disable tech savy people from downloading an audio file as some people mentioned, they can simply redirect the output of their sound card to a file.
Dealing with the headers was a little bit of a pain. You have to make sure you accept ranges, especially for Chrome.

- 4,047
- 6
- 27
- 30
This is neither possible nor benificial.
If the user has access to your file, the path will always be dicoverable.
There are ways to make this more difficult, or as @Mariano Montañez Ureta has pointed out make referrel URLs but you will always be able to get back to absolute.

- 18,485
- 28
- 81
- 134
You can handle this like a ebook shopping cart :)
So, you make a special URL to a user and that URL can be accesed X times or downloaded X time, then you hardcode the url to match to the real file, ex.:
http://www.example.com/hardcode.php?v=md5haswithsomeSeed will point to http://www.example.com/files/video.flv
So the end user onlye see the first URL not the second.

- 1,146
- 11
- 21
-
I was hoping to do this using PHP to serve the mp3 file. That seems to be very buggy as I can't seem to get all the headers right. This way, it is still pretty easy to find the path to the file through Chrome. If I decide to give up on the php mp3 server way, I 'll pick your answer. – Roozbeh15 Mar 09 '12 at 21:15
-
No, i don´t mean redirects... i mean like a "mirror" link, and the mirror link (http://www.example.com/hardcode.php?v=md5haswithsomeSeed) will up only a few downloads or hours. – Mariano Montañez Ureta Mar 11 '12 at 04:52
The answer to whether it’s possible to keep users from recording audio from the internet, streamed or otherwise, is “no”. It’s never possible, because it’s always possible for a user to redirect the output of their sound card to a file.