- Home /
WebGL Build - Video Player Shows Black Screen in all Browsers
Two Part Question
I have a video imported to a folder in my Unity 2019.2 project. The video player shows the video playing in the Game window on preview, but on WebGL Build-and-Run, both browsers (Firefox and Chrome) show only a black box and do not play the video.
Then I tried uploading the project to a web server, however there I run into another problem. On launch I get an error message that says: An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was: SyntaxError: expected expression, got '<'
So I look at the error in the web developer console for the browser, which gives me no information at all that I know how to use. It just says: Invoking error handler due to SyntaxError: expected expression, got '<' and it shows me the line (4953) in UnityLoader.js that generates the error message.
So why would the video work in the Game window, but not in the browser, and how can you test it on the web server if the published files are generating JavaScript errors?
Any advise would be appreciated.
Ok, I found the solution to Part II of this question, which is about the JavaScript error.
In Unity documents > https://docs.unity3d.com/$$anonymous$$anual/webgl-deploying.html?_ga=2.160056189.1547271299.1580113896-1099541612.1579098461
$$anonymous$$y web server is Windows based, so the part in the documentation about IIS and the web.config file allows my project to run in the browser (Only tried Firefox so far).
All I did was copy the provided code there and paste it into a new X$$anonymous$$L document, then save it and name it web.config. After that I dropped that file into the folder structure on the web server above the folder where I copied my Unity published files. It appears to work just fine for any folder below that level.
Now when I paste my testing URL into Firefox, the project loads and runs.
Edit > Reference Link > https://forum.unity.com/threads/syntaxerror-web-gl-build-in-web-server.485045/
Answer by JeffreyBennett · Jan 30, 2020 at 01:39 PM
Just trying to clear up anything that may possibly be causing that JavaScript error, I'm checking into this issue > https://answers.unity.com/questions/1695266/charactercontrollermove-called-on-inactive-control-2.html
I don't think they're related, but I'm striving for issue-free code.