与react-native-fbsk分享视频

时间:2017-10-17 14:28:35

标签: react-native fbsdk react-native-fbsdk

我试图使用react-native-fbsdk将视频发布到Facebook

到目前为止,我设法使用此代码将图片发布到Facebook!

        const sharePhotoContent = {
            contentType: 'photo',
            photos: [
                {
                    imageUrl: uri,
                    userGenerated: false,
                }
            ]
        };
        this.setState({ sharePhotoContent: sharePhotoContent, })
    })

我试图以多种方式发布视频,但我找不到正确的方法来做到这一点?

//这个没有用!!

 this.refs.viewShot.capture().then(uri => {
        const shareVideoContent = {
            contentType: 'video',
            localUrl: image,
        };
        this.setState({ shareVideoContent: shareVideoContent, })
    })

有人已经这样做了吗?

太棒了!

1 个答案:

答案 0 :(得分:0)

如果您选中this page,则可以找到视频共享内容结构。

export type ShareVideoContent = {
  // The type of content to be shared is photo.
  contentType: 'video',

  // Common parameters for share content;
  commonParameters?: ShareContentCommonParameters,

  // URL for the content being shared.
  contentUrl?: string,

  // Video to be shared.
  video: ShareVideo,

  //  Description of the video.
  contentDescription?: string,

  // Title of the video.
  contentTitle?: string,

  // The photo that represents the video.
  previewPhoto?: SharePhoto,
};

export type ShareVideo = {
  // The URL to the video. Must point to the location of the video on disk.
  localUrl: string,
};