Loading Video At Runtime

Hi guys/girls,

I am trying to write a quick and dirty little application to display image slides and videos using version 3.4. Everything works fine except I am seem to be unable to load videos at runtime. If I add them through the content pipeline app then everything is fine.

I download the video from the server and save it in the current working directory- this works fine. Then I try to load the video using Content.Load

                        webClient.DownloadFile("https://contentserver/videos/" + arraySlideDefinition[2], arraySlideDefinition[2]);
                    Slide slide = new Slide();
                    slide.duration = Convert.ToSingle(arraySlideDefinition[1]);
                    slide.video = Program.application.Content.Load<Video>(arraySlideDefinition[2]);

An unhandled exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in MonoGame.Framework.dll

Additional information: Could not load slide.mp4 asset as a non-content file!

I’ve read in one other post that somebody was able to get around this by building a custom XNB- but I’m not sure how to do that, and I’m also guessing that was with the older version of monogame that still used the XNA content pipeline, as I’ve only got an MGCB content file.

Any ideas?

You are trying to load a raw video file through the ContentManager. This is not supported. Videos added through the content pipeline have a .xnb file generated for them that the ContentManager can load.

XNA did not appear to allow downloaded videos to play (there is no Video.FromUrl(url) method that I can find similar to Song), and as we implemented the XNA API we have not added this either. Having said that, I don’t see it as a problem as long as the target platform can play the video file.

It is not currently in there, but it is something that could be added.