相关疑难解决方法(0)

是否可以使用Facebook SDK将视频从SD卡上传到Facebook?

我们可以通过Facebook SDK将视频从Android设备的SD卡上传到Facebook帐户吗?

如果是这样,有什么简单的例子?

android facebook facebook-graph-api

13
推荐指数
1
解决办法
1万
查看次数

将视频上传到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)

android facebook

5
推荐指数
1
解决办法
3283
查看次数

标签 统计

android ×2

facebook ×2

facebook-graph-api ×1