【发布时间】:2021-01-09 01:36:03
【问题描述】:
我有一个超级简单的 HTML5 游戏,我正在尝试在 facebook 嵌入式播放器中进行测试,但游戏总是卡在 0% 的加载状态,并且它没有记录我一开始的“测试”这个词,这意味着它甚至没有初始化。这是为什么呢?
https://www.facebook.com/embed/instantgames/YOUR_GAME_ID/player?game_url=https://localhost:8080
我已将 GAME_ID 替换为我的
index.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>
【问题讨论】:
-
任何帮助将不胜感激
标签: javascript html facebook facebook-instant-games