VideoPlayer GetTexture returns null

I’m just trying to play an mp4 video in my game, but GetTexture always returns null no matter what.

Surely mp4 is supported? And if it isn’t, will I have to convert it to another video type?

Code: https://imgur.com/a/NCgFM

Fix?

I’ve never personally done it, so done a quick google for you as I didn’t think what you were doing was right.

I found this on stack overflow:

https://stackoverflow.com/questions/14627529/play-video-in-monogame

Which then lead me to the below site from one of the answers:

https://github.com/CartBlanche/MonoGame-Samples/tree/master/VideoPlayer

Open the “Game1.cs” file at the above github site and see how they are playing the video.

In the loadContent put:

video = Content.Load<Video> ("sintel_trailer");
videoPlayer = new Microsoft.Xna.Framework.Media.VideoPlayer();
playVideo = true;

And in the update method put:

if (playVideo)
{
if (videoPlayer.State == MediaState.Stopped)
{
videoPlayer.Play(video);
playVideo = false;
}
}

Note: The stackoverflow question is now 5 years old so it might not work 100%, if not I’m sure one of the more regular monogame users will reply and correct me. :slight_smile:

Hope this helps.