我正在尝试使用以下代码将视频上传到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)