This project has moved. For the latest updates, please go here.

handling Seek position in case of streaming audio

Dec 17, 2012 at 11:10 AM



i am working on the project that uses web stream to play audio using Naudio Library, i need to show the slider for the playing audio and also to allow seek position backward/forward for the streaming audio.


Is there any way that we can feature out the length of audio playback time and can allow seeking track for at least to the portion of the track that has been already downloaded or cached.

Thanks if anyone can help with the sample code.



Dec 17, 2012 at 11:17 AM

it can be done, but it is a little tricky. Essentially you'd need to keep hold of the audio you'd already downloaded in some kind of memory buffer or temporary file. I'm afraid there is no sample code. One thing that you might want to check out is the new MediaFoundationReader in the very latest NAudio code (you'll probably have to download and build it yourself). That can actually do repositioning on streaming files and works surprisingly well. I don't know if you can tell how far it has downloaded though.