Welcome back. Get yourself a cup of coffee to accompany you through my video journey. I had coffee at every step so it makes sense that you have one too, don’t you think?
I had a bit of trouble with my intro video, my logo and just a general dislike of being disorganized or feeling like I’ve hacked at something. Apart from the issue where all my graphics are drawn pixel by pixel, I had another problem. I wanted to be able to use graphical overlays and background motion video and so on.
If you will, imagine the clouds moving by in the background while the “Start Game” button is showing.
There is no way to play video in all the lovely ways you would expect in Monogame without running into cross platform issues. I’m not referring to playing a movie and sitting back to watch it, that’s easy. I want picture in picture, I want multiple video’s to overlay each other, speed up and slow down at my command, that sort of thing.
Suffice to say that each mobile platform has some way to play a video and each way comes with pro’s and cons. For iOS for example, it means downloading third party projects and figuring out what they did or integrate their libraries and then hope and pray you don’t have sloppy stitch-together problems when you want to do the same for Android.
I don’t like this idea, it feels awkwardly hacked together and makes me feel like I’m losing my touch. I’m a programmer, not a Lego builder, even though I love Lego. After lots of prodding and pondering I decided to do it myself, in a way that exactly the same thing works on all the platforms I am currently testing on, so Windows, iOS and Android then.
Using some magic, with a few tear drops, a feather from a bird-that-became-cat-prey, a stare from my wife and one bucket load of elbow grease, I made my own video format. I call it “the vid”. The format is pretty cool yet simple. I spent some time on “tooling” so now I can convert any other video format to “the vid”. So that means I can take an MP4 or an MKV or AVI and I can turn it into a vid that will work on Windows, iOS and Android. I can also re-size the video in the process, making it bigger or smaller and reduce quality if I need to.
It is worth saying that I am only talking video here, I don’t care about audio since I’m not making movies, I make games. My “vid” format allows me to do all the programmer thingies that I want to do, such as triggering an event when something is on screen or me being able to specify exactly where on the screen the video should display, the frame rate and so on. They also support alpha channel transparency so I can overlay them with ease.
The files are nice and small-ish (for video) so I should be able to make it all work within the size constraints that allows users to download over 3G instead of WiFi.
Lastly, I can buffer my video straight from the disk, so I don’t have to load the entire video into memory in one go. This is important as on the lower-end of the scale devices have less memory. Talking about memory, playing the video doesn’t mess up my memory usage either. I keep it pretty steady with no leakage that, err, I can detect at this point. I’ll investigate further on that.
In all, this was fun. Maybe I explained this well enough that it’s not too technical, I hope you could follow. I could show you a video but that’s not really the point. A video is a video, it’s how I made it that is interesting, right?