[英]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.