我们可以通过Facebook SDK将视频从Android设备的SD卡上传到Facebook帐户吗?
如果是这样,有什么简单的例子?
我正在尝试使用以下代码将视频上传到Facebook
public void uploadVideosFacebook(String videoPath)
{
byte[] data = null;
String dataMsg = "Your video description here.";
String dataName="Mobile.wmv";
Bundle param;
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(API);
InputStream is = null;
try {
is = new FileInputStream(videoPath);
data = readBytes(is);
param = new Bundle();
param.putString("message", dataMsg);
param.putString("filename", dataName);
param.putByteArray("video", data);
mAsyncRunner.request("me/videos", param, "POST", new fbRequestListener(), null);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public byte[] readBytes(InputStream inputStream) throws IOException {
// this dynamically extends …
Run Code Online (Sandbox Code Playgroud)