【发布时间】:2015-10-02 10:39:24
【问题描述】:
我正在通过 Gradle 使用 Facebook Android sdk 4.6.0。
在根据Sharing on Facebook guidenline 配置 facebook 后,我尝试从移动目录上传视频,但在调用 shareddialog.show 后出现异常“ShareVideo 必须引用设备上的视频”。 `onError(FacebookException exception) 上的回调会向我报告该异常。
/**first checking if file exist than execute code, file exits and code execute but after executing callback with exception "Share Video must reference a video that is on the device" occurs
**/ private void shareOnFacebook() {
File dir = new File(Environment.getExternalStorageDirectory(),
"directory");
File video = new File(dir, "Video.mp4");
if (video.exists()) {//if video file exist
Uri videoFileUri = Uri.parse(video.getPath());
ShareVideo sv = new ShareVideo.Builder()
.setLocalUrl(videoFileUri)
.build();
ShareVideoContent content = new ShareVideoContent.Builder()
.setVideo(sv)
.build();
shareDialog.show(content); //show facebook sharing screen with video
}
}
【问题讨论】:
标签: android facebook facebook-sharer facebook-share facebook-exception