Vlc.DotNet
Vlc.DotNet copied to clipboard
VlcControl.Stop() deadlock and freeze application!
SourceProvider.MediaPlayer.Stop()
Version 3.0.0
freezes the application
Can you share your full code, please?
Did you try to call Stop()
from a VLC callback? https://github.com/ZeBobo5/Vlc.DotNet/wiki/Vlc.DotNet-freezes-(don't-call-Vlc.DotNet-from-a-Vlc.DotNet-callback)
This is in your example Samples.Wpf.Advanced, I changed to Stop
private void OnStopButtonClick(object sender, RoutedEventArgs e)
{
control.SourceProvider.MediaPlayer.Stop();
//this.control?.Dispose();
//this.control = null;
}
While I still don't know why the app freeze, I found a workaround:
ThreadPool.QueueUserWorkItem(_ => control.SourceProvider.MediaPlayer.Stop());
Workaround works for me. Thank you!
yes, If you use event function in VLC Display Callback function, then app will freeze.
Yes, but that's not the case here, Stop() is invoked on the main thread because it is triggered by a mouse click. I guess that the rule is : don't call Stop() on the same thread that created the Player, but I'm not sure why it does that...
EDIT : Just realized that it's in the WPF control. it must be because the Video callback wants to go to the main thread, locking the callback, while the main thread waits for the Stop() to complete
For your information. Don't call Stop(), Pause() and Play() from main thread. If call then deadlock.
@jeremyVignelles EDIT : Just realized that it's in the WPF control. it must be because the Video callback wants to go to the main thread, locking the callback, while the main thread waits for the Stop() to complete.
Thank you for information that the main thread waits for the Stop() to complete. I have a question. It's just stop() function? How about Play(), Pause(), Dispose()?