我正在尝试通过最新的facebook sdk分享视频。
我试图以这种方式做到这一点:
if (ShareDialog.canShow(ShareVideoContent.class)) {
Uri videoFileUri = Uri.parse(mFileMP4.getAbsolutePath());
ShareVideo shareVideo = new ShareVideo.Builder()
.setLocalUrl(videoFileUri)
.build();
ShareVideoContent content = new ShareVideoContent.Builder()
.setVideo(shareVideo)
.build();
shareDialog.show(content);
}
我收到了这个错误:
com.facebook.a.a﹕ Got unexpected exception: java.io.WriteAbortedException: Read an exception; java.io.NotSerializableException: org.json.JSONObject
有人知道这里发生了什么吗?
答案 0 :(得分:0)
您是否尝试将视频uri转换为字符串?像这样:
.setLocalUrl(videoFileUri.toString())
答案 1 :(得分:0)
试试这段代码
Uri videoFileUri = ...
ShareVideo = new ShareVideo.Builder()
.setLocalUrl(videoUrl)
.build();
ShareVideoContent content = new ShareVideoContent.Builder()
.setVideo(video)
.build();