tracking stream duration

Nov 18, 2011 at 1:37 PM



I am working on a streaming app and I want to track the duration (in seconds) of the amount of the stream that has been played. My streaming source provides the duration (in seconds) at the beginning of the stream and I would like to display a progressbar, but I need a way of tracking how much of the stream has been played. This is an MP3 stream and thus I am following the 'Streaming MP3 example', but I am at a loss on how to track the amount of played stream.


Any help would be greatly appreciated.



Nov 21, 2011 at 2:36 PM

once you have converted to PCM, the AverageBytesPerSecond property of the resulting WaveFormat can be used in conjunction with the total number of bytes Read out of the converted stream to keep track of progress. You might need to create a simple IWaveProvider implementation to wrap around your playback IWaveProvider to keep track of this number.


Nov 21, 2011 at 6:44 PM

Thanks Mark.

I went a little more primitive than your suggestion. I am simply tracking the amount of real time that has passed while the WaveOut device is in the play state.