I experimented with Chromecast (2013 and 2015 models) to try and launch a small Unity3D game. Basically, display 4 sprites on the screen. The game is compiled (by Unity tools) in WebGL using Emscripten on the server.
One of the problems I ran into is related to the size of the Javascript file. In this case, Empscripten creates a Javascript file that is approximately 24 MB. Chromecast successively crashes in one of several ways. The screen may flicker, it may freeze all black or all white / gray, or it may cause the screen to freeze the brain. In some cases, it eventually reboots, and in others it freezes until the power cycle.
To test the theory, I generated several Javascript file sizes and loaded them manually through a remote debugger. The generated file creates a series of variables, each of which is incremented by one of the previous variable to create a large file. I can’t snap the exact size, but somewhere between 40,000 and 50,000 lines Chromecast crashes. When I can get a good heap shot, it shows a size of about 8 MB. Sometimes it does not crash until you get a picture of the heap.
The following were used to generate javascript files of various sizes:
python -c 'numi = 41400; print("a1 = 1"); print("\n".join(["a{0} = a{1}
+ 1".format(i+1,i) for i in range(1,numi)]));
print("document.write(a{0});".format(numi));' > l41400.js
I tried some small Emscripten-based applications that worked perfectly. Applications with large Javascript files have led to the same behavior as the Unity game.
location.reload() , . , Javascript. .. - , .
64 ArrayBuffer, , , , .
Emscripten -split -js-split Javascript . . , Javascript.
, - , , - Javascript?