Search code examples
c#asp.netmp3

Play part of MP3 using ASP.NET


I have a huge mp3 file, which runs for 5 hours.

I want to create a ASP.NET website, where in user can listen to part of it online. like from 6th to 10th minute.

I cant download the entire file to the client. Also it will be same file for every user, only the timing will vary.

What is the efficient way to achieve this. I use VS 2005.

On a side note, I'm planning to port the site into a android app too at a later date.


Solution

  • If you don't want to load the entire file (which might be quite big, I assume something like 300 Mb ?) you can split it in parts of 1 minute files (or less...), and then only load the needed parts.

    You would have file named like bigfile_1.mp3; bigfile_2.mp3 ...

    Then in your client player, if you need to play more than one minute, you can start to load the next file when the user has listened to 30s of the first one for example, and so on...

    I'm not sure there is a javascript of flash mp3 player that does that though so you might have to do your own

    This technique is also used by live streaming music sites like Deezer to make it more difficult to download a file that is only meant to be listened on the website