Unity Videos in WebGL


Man, I thought it was going to be easy, but it was not even close. I wanted my game to look as awesome as possible, so I built eveyrthing in Blender, then rendered out the animation for a cut scene using Cycles. The result?  Blender popped out hundreds of individual frames which I was then easily able to import into Adobe Premiere and spit out a nice clean and small webm video. 

"This is great!" I thought to myself as I quickly and easily added the video player component to my camera and then attached said video. I tested my build. and voila! a beautiful cutscene played before my eyes. That was until I tried building a WebGL version of it. 

I wanted to see this (quality very low because GIF): 

but instead I was greeted with this:


I was pleased with the game's size, at just around 45MB. But the video would not play. I went through all of the steps and tutorials, of which there are many, but I just couldn't get my video to play. 

Switch to a URL they said: Get slapped with CORS violations.

Put it in streaming assets folder, they said: Video will load but not play out. 

Why? Why must it be this hard? The answer, Chrome and Firefox (and probably Safari and Opera too) won't allow the video to play because it has an audio track (a silent one) but an audio track nonetheless. The only way I was going to get it to play was to add a button that the user would have to click to make it play. 

I call BS! That's not how a cutscene is supposed to work, especially in a horror/thriller experience. It just needs to play when the point has been reached that it is supposed to play.

I had already published the game before I came to this realization. I didn't want to lose that momentum, so I found a work around:

I ADDED 250 STILLS TO AN ANIMATION TO PLAY OUT FIVE SECONDS OF PRERENDERED VIDEO!!!!!

I got the result I wanted to see, but at what cost? The new project was now over 100MB when zipped. I mean I wanted to get the content into the game, but instead of one or two short videos that totaled less than 10 MB, I now have a butt load of stills at 1700 kB each. A sad trade off to make a game work. Unity needs to go back to the drawing board on this one, IMHO.

What solutions have you found for this? I'd be interest in hearing your resolutions.

Files

REcallWeb1-1.zip Play in browser
Nov 21, 2022

Leave a comment

Log in with itch.io to leave a comment.