private async void DrawNextFrame(IntPtr context) { // Wait for the UI Thread to run to render the next frame. await videoBox.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new DispatchedHandler(() => { // Get the Width and Height of the Window (it can change at anytime) int w = (int)((Frame)Window.Current.Content).ActualWidth; int h = (int)((Frame)Window.Current.Content).ActualHeight; // Draw the next frame, swap buffers, and report the frame has been flipped mpv.OpenGLCallbackDraw(0, w, -h); mOpenGLES.SwapBuffers(mRenderSurface); mpv.OpenGLCallbackReportFlip(); })); }