Sascha-L / WPF-MediaKit

Microsoft Public License
367 stars 116 forks source link

How to clone a video from one WPFMediaKit element to another? #72

Closed tenisak closed 6 years ago

tenisak commented 6 years ago

Is it possible to copy a video that runs in one WPFMediaKit element to run at the same time in another element? What is the Goal: Video preview, controls, etc. will be on the first monitor. The second monitor (projector or large TV) displays the same video on full screen.

xmedeko commented 6 years ago

Yes, see D3DRenderer.CloneD3DRenderer().

tenisak commented 6 years ago

Thank you for quick response. To tell the truth, I do not know how to use it. I tried searching in the sample application, but there it is not used. I found it in the code here, but I do not know how to do it. (I'm using Capture Device, not video playback.) Can you advise me how to use CloneD3DRenderer to clone an image from a camera to another element?

xmedeko commented 6 years ago

I do not use camera, but the VideoCaptureElement is descendant of the D3DRenderer. And D3DRenderer is the FrameworkElement. So, just clone it and use it. Something like (just writing the code without testing):

<media:VideoCaptureElement x:Name="myCamera" />
<ContentControl x:Name="myCameraCloneWrap" />

And the code behind:

myCameraCloneWrap.Content = myCamera.CloneD3DRenderer();
tenisak commented 6 years ago

It's easier than I expected :-) Thanks a lot! I added it as an example to the basic examples in the wiki. I hope, it does not matter ;-)

xmedeko commented 6 years ago

+1 for the Wiki enhancement.