Calling stop locks the program.
I understand that calling Stop on a MediaPlayer has to be done in a separate thread and not in an callback.
I am doing that and it's still locking.
private void MediaPlayer_RTSP_EncounteredError(object sender, EventArgs e) { ThreadPool.QueueUserWorkItem(this.StopVideo); }
private void StopVideo(object stateInfo) { this.VideoView.MediaPlayer.Stop(); // Application freezes here, randomly. }
I'm using this Windows version 3.0.8.1: https://code.videolan.org/videolan/libvlc-nuget
And this: https://www.nuget.org/packages/LibVLCSharp.WinForms/3.4.3?_src=template
Also, calling Stop freezes even not calling on the EncouteredError. I just locked on this code:
private void RTSPTest_FormClosing(object sender, FormClosingEventArgs e)
{
if (this.VideoView != null && this.VideoView.MediaPlayer != null)
{
if (this.VideoView.MediaPlayer != null)
{
this.Invoke((MethodInvoker)delegate
{
this.VideoView.MediaPlayer.Stop();
this.VideoView.Dispose();
});
}
}
}