I want to play some videos in my XNA game. I have looked at this tutorial. I have tried it. It creates XNB file but also copies original WMV file into output content directory.

Is there some simple solution, how can I pack/hide original WMV file? I don't want user get it.

Thanks for any help.

  • \$\begingroup\$ Are you compiling in release or debug mode? \$\endgroup\$ Commented Feb 23, 2012 at 15:36
  • \$\begingroup\$ I tried it in both and both have the same results. \$\endgroup\$
    – zacharmarz
    Commented Feb 23, 2012 at 15:57
  • \$\begingroup\$ Is this an actual security issue or an anti cheating measure? \$\endgroup\$ Commented Feb 23, 2012 at 17:22
  • \$\begingroup\$ It's something like anti-cheating. But you don't have to carry, if video has to be hiden or not. I just have this problem and I need to solve it :) \$\endgroup\$
    – zacharmarz
    Commented Feb 23, 2012 at 17:26

3 Answers 3


The XNA video player component is very much an opaque box that only plays loose WMV files. You can't really pack the file.

All that the XNB file contains is a filename that points to that WMV file (plus some metadata for the Video object).

The content processor (VideoProcessor) is responsible for copying the WMV file along side the XNB file at build time.

You could perhaps just give it a sneaky extension (eg: "myVideo.dat") to hide it from end users. Unfortunately the provided content processor automatically renames file to give it a WMV extension - so you'd have to provide a replacement processor.

(Or just stick the video in a directory. Is it so bad if inquisitive users find it?)

  • \$\begingroup\$ User really shouldn't find it. The game is based on progress and when user reaches another level, he sees new video. \$\endgroup\$
    – zacharmarz
    Commented Feb 23, 2012 at 16:00
  • \$\begingroup\$ Go with the sneaky extension option. That should be enough for 99% of your users (most people have file extensions hidden), and it saves you messing around having to integrate a different decoder. Give them whacky filenames too, if you're worried. \$\endgroup\$ Commented Feb 24, 2012 at 1:26
  • \$\begingroup\$ What about embedding it in a .dll and writing it to disk at the location expected right before its needed? Longer loading times but it prevents the catastrophe of the user spoiling the game for themselves as long as fraps drops off the face of the earth at the same time. \$\endgroup\$ Commented Feb 24, 2012 at 5:26
  • 2
    \$\begingroup\$ @AndrewRussell - However, by default, Windows shows extensions for unknown types, so a weird file extension type will in fact show up. \$\endgroup\$
    – DMan
    Commented Feb 24, 2012 at 5:28
  • \$\begingroup\$ @DMan: Good point. And ClassicThunder provides a good alternate solution (but it's still a huge effort for very little gain). \$\endgroup\$ Commented Feb 24, 2012 at 7:50

I think when it comes down to it, short of writing your own codec or something, if a user wants to view the videos, they'll do it. For the most part though, I don't think "regular" players will be mucking about in the game's install directory.

If this is a single player game and they player chooses to ruin it for themselves by watching the video early, then so be it. It's their game, they paid for it.

If it's multiplayer, then maybe they'll be able to see something before they get there, but then, they could just ask a player who's already been there. This actually goes for single player too.

So, I'd say don't worry about it. Just make a great game that they'll want to keep playing to see the new videos.

  • 1
    \$\begingroup\$ This is really not possible (let user see videos). Just take it as it is. I just need to hide video files. \$\endgroup\$
    – zacharmarz
    Commented Feb 23, 2012 at 17:05
  • 2
    \$\begingroup\$ @zacharmarz If you're sending the files to the user and you want them to play them in your game, they can and will find a way to view them if they so choose. You can only make it difficult for them, not stop them. And, that said, once one player beats the system, the files are up for grabs. So, I guess you have to decide if it's worth spending all the time to protect those files when a user could, for example, beat your system by viewing your source code or, using a program like Fraps, just re-record them and distribute them anyways. \$\endgroup\$ Commented Feb 23, 2012 at 19:20
  • \$\begingroup\$ I understand you. But I don't ask if it's better to spend time implementing something to protect my files or just let it be. I want to try it. So if you have some idea, I will be glad if you write it here ;) \$\endgroup\$
    – zacharmarz
    Commented Feb 23, 2012 at 22:05

Stream your video instead. This will then only require "hiding" the video URL, although it won't work if your players are offline.

I've seen this pulled off in Flash games. When you reach certain progress points, they pull a (YouTube) video off the web and stream it in-game, and life is good. Again, players were pretty much guaranteed to have internet connectivity at that time.

I'm not 100% sure if you can pull this off in XNA and MonoGame though. I'm pretty sure XNA supports streamed video.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .