Posting equirectangular 360° panoramas on Facebook using Javascript Graph API

笑着哭i 提交于 2019-12-18 16:51:13

问题


I am trying to post 360° photos on behalf of my app's users, but I can't figure out how to make it work.

I loaded the Facebook Javascript Graph API, logged the user with "publish_actions" scope and used the following code to post a picture using equirectangular projection:

FB.api(
        "/me/photos",
        "POST",
        {
            "url": "MY_PUBLIC_URL",
            "allow_spherical_photo": true,
            "spherical_metadata": {
                "ProjectionType": "equirectangular",
                "CroppedAreaImageWidthPixels": 240,
                "CroppedAreaImageHeightPixels": 240,
                "FullPanoWidthPixels": 1962,
                "FullPanoHeightPixels": 981,
                "CroppedAreaLeftPixels": 981,
                "CroppedAreaTopPixels": 490
            }
    }, function (response) {
        console.log(response); // I get "{"id":"...", post_id:"..."} so no error
        if (response && !response.error) {
          /* handle the result */
        }
    }
);

It is posting correctly on the current user's timeline, but it is shown as a "normal" picture, not a 360° panorama.

Did someone implement a 360° panorama posting feature that works?

My photo should have the correct ratio (2:1) and is a correct 360° photo.

Thank you in advance for your help.


回答1:


I finally found a working solution for my issue: only put "allow_spherical_photo": true and remove spherical_metadata.

Then, the 360° pictures need to have metadata on them, in order for the Facebook processing to display them properly (XMP metadata as explained here: https://developers.google.com/streetview/spherical-metadata)

Thanks.



来源:https://stackoverflow.com/questions/41703553/posting-equirectangular-360-panoramas-on-facebook-using-javascript-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!