通过iOS应用程序在Facebook上分享视频总是改变其方向

时间:2015-10-28 10:17:46

标签: ios iphone facebook video orientation-changes

我正在使用Facebook iOS SDK版本4.0.1,当我在Facebook上发布视频时,每次上传时它的方向都会改变,即当我分享在肖像模式下捕获的视频时,那时视频分享Facebook改变为横向模式(因为我分享屏幕截图),当我以横向模式捕捉时,它将其方向更改为肖像(因为我共享截图)。

我正在使用以下代码在Facebook上分享视频:

FBSDKShareDialog *facebookShareDialog = [self getShareDialogWithVideo:assetURL]; // assetURL : video asset url from gallery or camera 
if ([facebookShareDialog canShow]) 
{
    FBSDKShareDialog *shareDialog = [self getShareDialogWithVideo:assetURL];
    shareDialog.delegate = self;
    [shareDialog show];
}

- (FBSDKShareDialog *)getShareDialogWithVideo:(NSURL *)videoUrl
{
    FBSDKShareDialog *shareDialog = [[FBSDKShareDialog alloc] init];
    shareDialog.shareContent = [self getShareVideoContent:videoUrl];
    return shareDialog;
}

- (FBSDKShareVideoContent *)getShareVideoContent:(NSURL *)videoUrl
{
   FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
   video.videoURL = videoUrl;
   FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
   content.video = video;
   return content;
}

当我以纵向模式从相机捕捉视频,并在Facebook上分享时,我得到了以下屏幕,我可以说Facebook会自动更改视频方向:

screen shot for share video in portrait mode

当我分享风景视频时,它会自动旋转并进入以下屏幕:

screen shot for share video in landscape mode

0 个答案:

没有答案