Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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: – James Aug 23 '11 at 17:38

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:

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: - 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). - 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:… 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


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.