问题描述
我正在代表我的应用程序的用户发布360°的照片,但是我无法确定如何使其工作。
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.
我加载了Facebook Javascript Graph API,使用publish_actions范围记录用户,并使用以下代码使用等角投影来发布图片:
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 */
}
}
);
在当前用户的时间轴上正确发布,但显示为正常图片,没有一个360度的全景照片。
It is posting correctly on the current user's timeline, but it is shown as a "normal" picture, not a 360° panorama.
有人实现了360°全景照片功能吗?
Did someone implement a 360° panorama posting feature that works?
我的照片应该具有正确的比例(2:1),并且是正确的360°照片。
My photo should have the correct ratio (2:1) and is a correct 360° photo.
提前谢谢您的帮助。
推荐答案
我终于找到了一个解决问题的解决方案:只需将allow_spherical_photo:true
并删除 spherical_metadata
。
I finally found a working solution for my issue: only put "allow_spherical_photo": true
and remove spherical_metadata
.
然后,360°图片需要有它们的元数据,以便Facebook处理显示它们(XMP元数据如下所述:)
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)
谢谢。
这篇关于使用Javascript Graph API在Facebook上发布等角360°全景图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!