Reputation: 4013
I'd like to have one mp3 file and play certain parts of it, like css sprites. Meaning, defining offsets and duration from the original file. For example, say I have a one minute mp3 file and I want to play seconds 30-35 from it.
Looking for a way to do that in .net, preferably, but not a must.
Thanks!
Upvotes: 1
Views: 177
Reputation: 29639
The first decision is whether to do this "client side" (i.e. in HTML/Javascript) or server side (i.e. in whatever language your site is built in, e.g. PHP, C#, Ruby, etc.).
Your edit says you want it in .Net - so if you want to do it server-side, you'll have to find an audio library (see this SO question), and "seek" to the right point in the MP3 stream, then return that to the browser with the appropriate MIME type.
However, you should be careful with such an implementation - you may well find supporting large numbers of requests could choke, especially if you can't load the MP3 files into memory and have to read them from disk for every request.
The alternative is to do it client side - probably using a library like JPlayer, which supports "seeking" to a location in an MP3 out of the box.
This creates a simpler server implementation, and should support all browsers - though you are at the mercy of the library creators to guarantee that.
Upvotes: 1