We sold a game to a customer and he gave the the following feedback. Maybe you have a solution for this?
I’ll try to describe the issue as we faced and how we were able to drill down to the probable cause:
Context on what we are doing:
For loading the game on the android app, we download and cache the whole game bundle locally to reduce the download time for subsequent game loads. We leverage the request interceptor functionality of WebView to intercept the network request and then use the WebViewAssetLoader to load the response for the intercepted request from internal storage.
Issue we faced:
For android devices with Android 10 and lower, the game is unable to load from the local cache. Loading works fine if we load from the internet.
The following error is observed:
I/chromium: [INFO:CONSOLE(27)] “Uncaught (in promise) #<Event>“, source: https://d2cx3uugochcmv.cloudfront.net/h5-game-bundles/smp_game-v15-pr_basic_table/scripts/main.js (27)
Debugging the issue
This seems to be the behaviour in pre Android 10 devices and is happening for all our games. For post android 10, the MIME type inference works properly for js files.
If MIME type reporting is broken then why other games are not affected?
If we revisit the above error log, we can see the following clause: “Strict MIME type checking is enforced for module scripts per HTML spec”
This means that if we are using js modules in the games, then this issue will occur. It might be possible that other games are not using js modules while the game is using them.
Goin through the code for the other games, we found out that js modules are not being used in those. Hence, the issue does not arise for other games.
Earlier game version is unaffected? What changed?
Comparing the diff between earlier and current versions of the game, we found out that indeed, js modules are being used now. In the AddScript function in c3runtime.js, we are dynamically adding script elements with type “module”. This change is not there in earlier versions. There are other instances too, but this one was the most obvious.
If you guys have any insights into the MIME type issue such that it can be resolved without removing js modules, please let us know.
The initial build did not have this dependency on js module.
Can you crosscheck, if we can remove the dependency because its something that only got added on later
Thanks and Regards,
What could be the best solution. No idea what feedback I could give them. Could you help me/them?
THANKS IN ADVANCE