Rendering not working with MediaElement windows RT

会有一股神秘感。 提交于 2019-12-31 05:17:12

问题


I need to take thumbnail from Video playing with MediaElement

For this i learn there is RenderTargetBitmap in windows 8.1 API

RenderTargetBitmap a = new RenderTargetBitmap();
await a.RenderAsync(myMedia);
thumb.Source = a;

and second way i got with help of WinRTXamlToolkit.Composition toolkit which do rendring with WriteableBitmapRenderExtensions class

WriteableBitmap w = await WriteableBitmapRenderExtensions.Render(myMedia);
thumb.Source = w;

Both these methods are working with all UIElement but not with MediaElement

only black screen is visible when source this to Image object.

Can any one tell me why? and how can i take thumbnail from video?


回答1:


It seems like the methods you mentioned might be limited in that regard. I'd still try RenderTargetBitmap but with something overlaid on top of the MediaElement. I believe if you place anything on top of a MediaElement, like a 0.01 opacity, 1x1 sized, black rectangle - it will switch to run in some different rendering mode where it is possible RenderTargetBitmap would be able to render it. Otherwise I think someone discussed here a while back a question of capturing a frame from a video stream. IIRC it is a pretty involved process though, involving using DirectX or Media Foundation and quite a bit of native code.



来源:https://stackoverflow.com/questions/17971111/rendering-not-working-with-mediaelement-windows-rt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!