Search code examples
htmlmp3

Hide mp3 url while playing audio file


I have a webpage that offers dynamic downloading of mp3 files through mobile phones. I would like to add a feature where someone can listen to the song through their desktops before downloading the file.

The challenge is, I don't want the mp3 file link to be displayed in the page code, I would prefer a different url e.g

<a href='http://mysvr.com/getfile/121233444/'>Preview song</a>

which is passed on to a player that expects an mp3 file source and get it to play the file.

I don't want the person previewing the file not know the real url of the file that is playing to prevent unauthorised downloads.

What do I need to do?


Solution

  • First deny all the access to the directory which has mp3 files through the internet. Then write a handler file to play the mp3's. The handler file will get the name of the mp3 from query string and play the file on player. Taking the url , parsing and playing will be done in codebehind so users wont be able to see the url of the mp3

    hope it helps.