HTML5 Export - Dependency on Fullscreen button

PS: If the tone sounds a little harsh, that was not my intent. Sorry for that.

Currently when you export to HTML5, you get a sample/template html file with the data.
I have to say that this html has a lot of errors (especially closing tags that close nothing) and js part seems to be written in a hurry.

I have rewritten the js and html for my own taste, including the Module component. But when I tried to run the html, I also found that there is a dependency for the “fullscreen” button that appears in the template. Everything is deletable except this button. Removing the dependency is impossible for the developer as the code is precompiled + obfuscated + etc by emscripten…

If I’m correct, when UE4 is exporting the game code via emscripten, it imports another js file which includes the game + graphics engine for webgl. In there somewhere, someone forgot to add a check for existence of the button with id “fullscreen_request”. As there is no “undefined/null” check, when the code hits, this error is thrown:

exception thrown: TypeError: Cannot read property 'addEventListener' of null,TypeError: Cannot read property 'addEventListener' of null
    at Object.JSEvents.registerOrRemoveHandler (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:1:44174)
    at Object.JSEvents.registerMouseEventCallback (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:1:47948)
    at _emscripten_set_click_callback (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:1:323575)
    at GbM (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:12:1099387)
    at o8L (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:12:1024521)
    at A4L (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:12:946409)
    at Array.NbM (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:12:1100143)
    at UZA (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:31:828251)
    at SZA (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:31:827899)
    at tB (blob:http%3A//xxx.xxx.xxx.xxx/4b1846e7-c655-4667-a3b0-5bbee1527377:24:161891)

If you can point me to these js files (if not obfuscated) I can remove the fullscreen button dependency and request a merge from Github.

Hi emrahgunduz,

when UE4 is exporting the game code
via emscripten, it imports another js
file which includes the game +
graphics engine for webg
That’s not quite the case, the dependency is coming from the C++ code. You’re looking for a call to emscripten_set_click_callback() in the FPlatformOpenGLDevice c’tor. I’m not sure a null check it needed there as my expectation is for that function to return an error in the case that button doesn’t exist. You may want to investigate what that function is doing by browsing through the emscripten SDK.

WRT the html template, I think it was only ever designed as an example that would be replaced and as such hasn’t got as much care as it possibly needs. If you do have improvements for it we’ll happy look at accepting a pull request :slight_smile:

I have - currently, changed the template html so drastically I do not think that everybody would like that :slight_smile: . Yet it is modular and easily customizable.

I would very much like to give it a go for the cpp + html + js part on the export process.

If you can direct me, I’ll need the location in the source that has a part in exporting process. A source folder and/or a starting name is sufficient enough, I can work through that point and discover what is going on.

That template looks AMAZING. Any chance of sharing some bits?

well, i’ve changed the default js and html files to fit to my project. it involves messing with emscripten python files and it breaks the default html packaging for unreal. I needed this for a project that we are working on. Our deadline is in 2 weeks and I made a schedule to share everything that I’ve learned about Unreal Engine HTML, and also code that I wrote on Github. Including TCP sockets, a simle game server for simple multiplayer games, talking and listening javascript, and making sure that “download maps on the fly” works correctly. Just give me 2 weeks :slight_smile:

would you mind to share the codes ?