Scirra / Construct-bugs

Public bug report submissions for Construct 3 and Construct Animate. Please read the guidelines then click the 'Issues' tab to get started.
https://www.construct.net
107 stars 83 forks source link

FB Instant Games Plugin Adds 4 seconds of Black Screen before the game loads on Mobile #1583

Closed jagoman85 closed 6 years ago

jagoman85 commented 6 years ago

Problem description

Including the Facebook Instant Games Plugin within a project adds 3-4 seconds of black screen before a game is loaded on Android & iOS applications.

Attach a .c3p

An empty project with the Facebook Instant Games Plugin. black-screen.zip

Steps to reproduce

  1. Export the project as an APK or for iOS (Different export compression settings don't affect the result)
  2. Test the exports on a device

Observed result

There is 5-6 seconds of black screen in total before any splash screen is shown.

Expected result

There should be no black screen when game is first loaded (or at least only 2 seconds)

Affected browsers

AshleyScirra commented 6 years ago

Unfortunately a bug in the Instant Games SDK means it silently fails to load when Instant Games is unavailable. Since the game is meant to wait for Instant Games to load before proceeding this makes the game fail to load entirely. I asked Facebook to fix this but they haven't done anything yet. As a hack we work around this by giving Instant Games a 4 second time limit to load; if it hasn't loaded in that time we turn off Instant Games support and continue loading. So currently this is a forced workaround due to the bug in the Instant Games SDK.

To avoid the timeout affecting Cordova apps I've simply disabled Instant Games support if it's in Cordova so there won't be any delay. This is done for the next beta.