繁体   English   中英

Facebook Instant Games 卡在 0% 加载

[英]Facebook Instant Games stuck at 0% loading

我有一个超级简单的 HTML5 游戏,我正在尝试在 facebook 嵌入式播放器中进行测试,但是游戏总是卡在 0% 的加载,并且它没有记录我一开始的“测试”这个词,这意味着它甚至没有初始化。 这是为什么?

https://www.facebook.com/embed/instantgames/YOUR_GAME_ID/player?game_url=https://localhost:8080

我已将 GAME_ID 替换为我的

索引.html

<script>

      FBInstant.initializeAsync().then(function() {
            console.log("test");
            var progress = 0;
            var interval = setInterval(function () {

                progress+=3;
                FBInstant.setLoadingProgress(progress);

            } , 100);

      FBInstant.startGameAsync()
          .then(function() {
          // Retrieving context and player information can only be done
          // once startGameAsync() resolves

          var playerName = FBInstant.player.getName();
          var playerPic = FBInstant.player.getPhoto();
          var playerId = FBInstant.player.getID();

          // Once startGameAsync() resolves it also means the loading view has 
          // been removed and the user can see the game viewport

          game.start();
      });
    });
</script>

Facebook 即时游戏将在 HTTPS 上运行,您的 chrome 浏览器选项卡之一应在 localhost URL 下方打开

https://localhost:8080

然后在下一个选项卡中,您应该运行下面的 URL,现在它可以正常工作了。

https://www.facebook.com/embed/instantgames/YOUR_GAME_ID/player?game_url=https://localhost:8080

变量“游戏”似乎有问题。 我找不到它是从哪里开始的。 当我用“游戏”暂时禁用命令并且它不再停留在 0% 时。 尝试调试该变量,您可能会解决问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM