NAudio: How can I get a event that tells me that the MP3 file reached the end?
Posted
by Rookian
on Stack Overflow
See other posts from Stack Overflow
or by Rookian
Published on 2010-04-03T13:02:26Z
Indexed on
2010/04/03
13:03 UTC
Read the original article
Hit count: 397
I tried to use this:
private void CreateDevice()
{
_playbackDevice = new WaveOut();
_playbackDevice.PlaybackStopped += PlaybackDevicePlaybackStopped;
}
void PlaybackDevicePlaybackStopped(object sender, EventArgs e)
{
if (OnPlaybackStopped != null)
{
OnPlaybackStopped(this, e);
}
}
But it never invoked.
Then I tried to use the PlaybackState:
public PlaybackState PlaybackState
{
get
{
if (_playbackDevice == null)
return default(PlaybackState);
return _playbackDevice.PlaybackState;
}
}
But when the song ends it does not change to "stopped". But when I call Stopped it changes correctly.
Can someone help me?
© Stack Overflow or respective owner