Take the 2-minute tour ×

How can I embed a video in a XNA application? I'm developing a card game with XNA C# and I need to send webcam video between four machines. Could anyone give me some tips about that?

share|improve this question
A quick use of google returned a few results, the first one that didnt loop back to a SE site was: c-sharpcorner.com/UploadFile/iersoy/2578 –  James Aug 23 '11 at 17:38

1 Answer 1

I believe the general solution to this is to capture the webcam images and apply it to a Texture2D. This is known as rendering to a texture. You can find more information here: http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series3/Render_to_texture.php

Be warned that that tutorial is made for XNA 3.1 so it might need a bit of work porting it to XNA 4.0 code.

I've found a few webcam components/image capture facilities that are written in C# so they can be used along with the XNA framework:

http://stackoverflow.com/questions/1789684/webcam-calling-in-xna - This SO question provides a few answers and even some techniques to apply the webcam stream to an image (although it's a very dirty way in my opinion).

http://forums.create.msdn.com/forums/p/1467/9530.aspx#9530 - This forum post provides an XNA specific Webcam component that allows you to capture the images to a texture. I believe this to be fairly buggy, but the code should provide you with a good starting point.

Hope that helps!

share|improve this answer
That tutorial is a bit off, but I used it as the basis for my answer here, which is for 4.0: gamedev.stackexchange.com/questions/16206/… It covers rendering to a RenderTarget2D, then how to to render that to the screen (ie. exactly the same as any texture) –  Matthew Scharley Aug 24 '11 at 4:06

Your Answer


