I have a MediaPlayerElement playing a random video file and a "Capture" button. When I click a button, I want to get a screenshot of the video as a SoftwareBitmap object. I was able to do it from the Camera using MediaCapture and deviceId but I can't find how to handle it from the playing video file.
I found this code but it doesn't work for me
var bitmap = new RenderTargetBitmap();
await bitmap.RenderAsync(mediaPlayerElement);
var pixelBuffer = await bitmap.GetPixelsAsync();
var videoCapture = SoftwareBitmap.CreateCopyFromBuffer(pixelBuffer, BitmapPixelFormat.Bgra8,
bitmap.PixelWidth, bitmap.PixelHeight);