NAudio icon indicating copy to clipboard operation
NAudio copied to clipboard

While using Audio from URL my entire WinForm disappears

Open Spontini opened this issue 3 years ago • 0 comments

I'm using this code to test it out, the code works but this makes my WinForm disappear, while (wo.PlaybackState == PlaybackState.Playing) this line does the trick.

using(var mf = new MediaFoundationReader(url))
using(var wo = new WaveOutEvent())
{
    wo.Init(mf);
    wo.Play();
    while (wo.PlaybackState == PlaybackState.Playing)
    {
        Thread.Sleep(1000);
    }
}

Spontini avatar Jul 16 '21 17:07 Spontini