public void Close()
{
if (_vlcPlayer != null)
{
if (CurrentState != MediaPlayerState.Stopped)
{
Stop();
}
lock (_controlLock)
{
if (_vlcInitializeTask != null)
{
_vlcInitializeTask.Wait(20000);
_vlcInitializeTask = null;
GC.Collect();
}
}
lock (_controlLock)
{
try
{
_vlcPlayer.Dispose();
_vlcPlayer = null;
}
catch (Exception ex)
{
Debug.WriteLine("We ran into an exception disposing vlc instance");
Debug.WriteLine(ex);
}
}
}
}