Categories
.net

XNA Game Studio: I could play video but I’d rather not

Did you ever try to play a video inside your DirectX application, or a newer XNA Game Studio? One could assume that this is a trivial task, right? WPF lets you play it, heck, even Silverlight has no problems playing video – it is a matter of setting a bunch of properties on a proper object and voila.

So, XNA (same goes for DirectX) shouldn't have problem playing videos, too. WRONG. Playing video in XNA is a tricky, difficult and  you don't know when you'll get an unmanaged exception. Every solution out there I saw is based on DirectShow COM thing (luckily, there is a .net wrapper for DirectShow at http://directshownet.sourceforge.net/) like i.e. XNA DirectShow Video Player. But don't think this is an excellent solution. Dealing with video is still very problematic – while I haven't yet tried the mentioned video player I tried some other similar solutions and none of them is rock solid.

The logical question would be: why doesn't [MS] support video playback in XNA natively (through whatever library as long as one doesn't have to deal with low level details)? Or better, playing video to texture would be more than enough. Didn't they think of it? Sure they did, there is even a very highly rated request at Connect. It is dated back to year 2006! After a week or two it has been marked as Closed – Postponed. That's it.

This issue begs for two questions:

  1. Is it really that difficult to add video to texture playback in XNA/DirectX?
  2. Why bother giving feedback to Connect at all?

I/We are not asking for some obscure feature after all. Having the video manipulation ability opens many interesting possibilities. Interestingly, video to texture playback was introduced with first versions of Managed DirectX library and soon after discarded, I guess because of bugs.

What gives? I guess we'll have to deal with that DirectShow directly in one way or another for a long time to come. Or pay a huge price to a 3rd party. Is there a third solution I am not aware of?

UPDATE [19.10.2008]: I just found Scurvy Media project on CodePlex that does play a subset of AVI video -> texture without messing with DirectShow. It looks quite promising. Perhaps the biggest drawback is lack of audio playback (not sure about this, looks like is roadmapped to next release).

Leave a Reply