javascript - Facebook Instant Games 卡在 0% 加载
问题描述
我有一个超级简单的 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>
解决方案
变量“游戏”似乎有问题。我找不到它是从哪里开始的。当我用“游戏”暂时禁用命令并且它不再停留在 0% 时。尝试调试该变量,您可能会解决问题。
推荐阅读
- sockets - UDP 与 TCP 套接字要求
- spring-mvc - java.lang.ClassCastException:[Ljava.lang.Object;不能施放
- node.js - 一个把手#each 不适用于 Heroku
- java - 使用特定的 ClassLoader 获取 CtClass
- python - 有没有办法通过比较符号来解决 SymPy 中的两个矩阵?
- python - 在python中从当前时间生成1分钟的时间间隔
- javascript - 多个modals只能关闭1个
- vue.js - 当 Vue.js 路由器路径为 /apple-app-site-association 时如何打开文件
- python - 使用 python 和正则表达式从 reddit 评论中删除链接
- android - 如何编辑 gradle 以使用 Recyclerview