Dear community, I am experiencing crashes when trying to launch the VideoPlayer and ImageViewerControl controls from inside a dispatcher.
Recently something in my app has started calling the controls from another thread rather than the main UI thread (still trying to figure out why)
We started using Dispatchers and Invokes but it still crashes, here is a sample piece of code where the issue happens:
Dispatcher dispatcherUI = Dispatcher.CurrentDispatcher;
dispatcherUI.BeginInvoke(new Action(() =>
{
streamingPanel.Controls.Clear();
VP.MediaElement.Source = new Uri(path);
streamingPanel.Controls.Add(EH);
VideoIsPlaying = true;
VideoRandom = isRandom;
VP.MediaElement.Play();
this.BringToFront();
this.TopMost = true;
Log.SaveLog("Mostrando video: " + path);
}));
Does anyone know why this happens and how we can solve this?
Many thanks,
Adrián