MonoGame 3.8 - Videos [update 18/1]

Are Videos properly implemented in this version yet? When I compile my mp4 using H.264 Video importer and Video - MonoGame processor, output xnb file is about 1Kb in size. Videos get loaded properly and for example Duration attribute is correct. Game crashes on following code:

VideoPlayer vp = new VideoPlayer(); Video v = video_get("MyVideo").VideoSource; // v contains valid duration, framerate, path vp.Play(v); // crashes on nullreference0

Running this on Windows10, DX.
Would be grateful for any info about this, thanks!

Turned out MonoGame itself plays video well, problem is caused by MonoGame.Forms which I guess doesn’t initialize some mandatory systems. As for audio to work FrameworkDispatcher.Update();needs to be called, are there any steps required to get video working?

When was MonoGame 3.8 released?

I thought the latest version was 3.7.1…


3.8 refers to a development build.

Oh… That makes sense… :sweat:

As you guys cleared out what 3.8 means, any tips to get this working? Did some research and was able to get this running using native sharpDX media, but would be nice to run via the framework.

There’s nothing special that needs to be done to play video (like use FrameworkDispatcher), I’m not sure what’s going wrong in MonoGame.Forms.

@Jjagg any chance you would look into this? This is above me, can’t locate why it isn’t working in Forms. Opened up but the author seems to be busy with other stuff recently. Being a student I can’t afford to pay that up properly, but I can spare 50$ (paypal / bank transfer) if you could point me the right direction.Thanks and I am sure this will help others too.

Hey and thanks for reporting this issue.

You are right, i’m very busy in the moment and can’t tell when I have time to take a closer look, but I will try as soon as I can.

1 Like

My thanks, should you fix it that price tag offered by me will be yours as a little compensation.

1 Like

I had a little moment in a short break @ work and did a little debugging session.

I found the problem and will push the fix soon.

The problem was that the VideoPlayer creates a video cache (Texture2D) to play the video. For that it needs to get the current GraphicsDevice by accessing the current Game instance, but this is not possible in MonoGame.Forms, because it doesn’t rely on a Game instance.

I fix this issue by creating a new ctor for the VideoPlayer where it’s possible to give the GraphicsDevice from the GraphicsDeviceControl of your custom MonoGameControl by overloading it.

I already tested this and it properly plays the video in MonoGame.Forms!

Also thanks that you want to support the project with a donation, this is always appreciated. I will create a PayPal donation button on the GitHub page of the MonoGame.Forms project soon (together with the new update).

I will inform you about the new update here and in the showcase thread.

Thanks for your support!

I think I can manage to push this new update to GitHub and NuGet this evening or tommorow. I hope this is fine.


1 Like

That’s simply great, also puts light on why it crashed with nullreference (video player tried to access a game object which doesn’t exist), thanks for the time you’ve spent on this and foremost for MonoGame.Forms, once you patch donate button I’ll make my donation. Have a nice day, looking for updated nuget package.

For the sake of completeness, traced as @BlizzCrafter suggested and it’s pretty obvious. Feels bad I hadn’t found that before, it’s so simple!

1 Like

No spare time for me today!

Here is the new update:


Time to sleep.

1 Like