3

Game is onboarded, I receive the state of the user and all is just ready to go. I am trying to build a quiz game. I am fetching all the information from a remote server which includes image assets on a question basis. I can fetch the remote data but I cannot display the image. It seems that facebook is blocking them.

I tried to add a CSP header to the image server with a Content-Security-Policy: img-src *.fbsbx.com. Also tried * before that. It all does not seem to work. The only thing which works is to upload the image asset to facebook's hosting.

There is no information from Facebook's side. Anybody here got some information?

4

1 回答 1

3

根据这篇文章(即时游戏内容安全政策),Facebook Instant Games 似乎正在阻止某些媒体。它们确实允许使用 blob。因此,我将图像作为 blob 获取并将其转换为可以在图像上设置的数据对象。

            fetch(imageUrl)
                .then(function (response) {
                    return response.blob();
                })
                .then(function (myBlob) {
                    let myImage = document.getElementById('my-image');
                    myImage.src = URL.createObjectURL(myBlob);
                });
于 2018-10-01T16:17:24.070 回答