I'm currently developing a web radio app and if the user presses the pause/stop key the stream should stop and of course when he presses play again the stream should continue.
The problem I have is, that player.Stop() only pauses the track. If you press continue again, the first 5 secounds are not read from the stream but from a buffer, then it playes no sound for a few secounds and then begins to read from the stream again.
This is fatal for a web radio app. How can I fix it? Or how can I delete the buffer?
protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
{
switch (playState)
{
case PlayState.TrackReady:
player.Play();
break;
case PlayState.Stopped:
player.Stop();
break;
case PlayState.Paused:
player.Stop();
break;
}
NotifyComplete();
}
Allright.. just to let you guys know, this is what I did. I don't know if there's any better way but this works for me: