Unable to play Video/CaptureDevice the second time

Sep 3, 2009 at 2:25 PM
Edited Sep 3, 2009 at 4:30 PM

Hi there,

I was playing around with VideoCaptureElement and MediaUriElement. I can succesfully show my webcam and play a video. But: When I close the window containing one of these elements that played successfully and create a new window with one of these elements, I cannot show video or webcam, as it raises the MediaFailed event and points to an exception in Vmr9Allocator line 489:

m_device = (IDirect3DDevice9)Marshal.GetObjectForIUnknown(dev);

GetObjectForIUnknown throws an exception. Is there any way I can handle this and be able to create second instance? Please note: I am not talking about two instances at the same time, but one after the other. I hope you guys can help me.

Update: I can open many windows with one of the elements at the same time - no problem. But as soon as I close one of the windows, I cannot create new elements anymore.

Best regards,

Franz Mayer

Sep 28, 2009 at 12:29 PM

Hi there,

I've the same Problem. After Closing the WPF Dialog with the Webcam on it, i can't show Webcam Images when open the Form once again.

After Restart the Applikation functions once.

Thangs

Thomas Kunz

Coordinator
Sep 28, 2009 at 7:28 PM

What build of MediaKit are you using.  If you try my latest test build from source, does it do the same?

I now use one static D3D device with the VMR9, shared throughout the application.  I do this because I noticed some lower end cards would crash if I instantiated too many D3D devices.

Sep 29, 2009 at 5:48 AM

Hi,

I Used the Version downloadat yesterday from Main Download

 

Coordinator
Sep 29, 2009 at 6:14 AM
I was not able to reproduce your issue.

I did this real quick in the sample app on a blank window w/ a button click handler:

 new WebCamPlayerWindow().ShowDialog();

I then selected a camera, let it play then closed the window.  I repeated this several times with no issues.  Is this different than the way you are using this control?

In MediaElementBase, whenever the control is added to the loaded tree, it hooks into the parent window's Close event.  If this happens, the element will shut down the player and close all resources.
Sep 30, 2009 at 12:40 PM

Hi there, sorry my long abstinence...

It seems that the newest source fixes this issue. I now can open and close windows after each other and am still able to open the device again.

Thanks alot to the creators of this library - very great!