Publish 360 ° one-way panoramas on Facebook using Javascript APIs

I am trying to publish 360 ° photos on behalf of my application users, but I cannot figure out how to make it work.

I downloaded the Facebook Javascript Graph API, registered the user with the publish_actions scope, and used the following code to publish the image using an equiang 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 */ } } ); 

Correctly placed on the current user timeline, but displayed as a "normal" image, not a 360 ° panorama.

Does anyone implement a 360 ° pan panorama function that works?

My photograph must have the correct ratio (2: 1) and is the correct 360 ° photograph.

Thank you in advance for your help.

+6
source share
1 answer

I finally found a working solution for my problem: just set "allow_spherical_photo": true and delete spherical_metadata .

Then, 360 ° photos must have metadata on them so that Facebook processing displays correctly (XMP metadata, as described here: https://developers.google.com/streetview/spherical-metadata )

Thanks.

+3
source

Source: https://habr.com/ru/post/1014160/


All Articles