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 by polling the property with a timer:
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?