无法在Android中发布Facebook视频

时间:2012-05-22 06:17:36

标签: android facebook

我正试图通过我的Android应用程序在facebook上发布视频。但我无法完成那件事。 Logcat没有错误。在下面添加我的代码。

private void PostVdoFacebook(String review){
      mProgress.setMessage("Posting ...");
      mProgress.show();
      String response=" ";
      AsyncFacebookRunner mAsyncFbRunner = new AsyncFacebookRunner(mFacebook);
      FileInputStream is;
      Bundle params = new Bundle();
      try{
       is = new FileInputStream(getRealPathFromURI(uriVideo));
       byte[] data = readBytes(is);

      params.putByteArray("video",
        data);

     } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
     }
      params.putString("caption", review);
      mAsyncFbRunner.request("me/videos", params, "POST",
                 new PhotoUploadListener());
     }

,readBytes函数是

 public byte[] readBytes(InputStream inputStream) throws IOException {
      // This dynamically extends to take the bytes you read.
      ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream();

      // This is storage overwritten on each iteration with bytes.
      int bufferSize = 1024;
      byte[] buffer = new byte[bufferSize];

      // We need to know how may bytes were read to write them to the byteBuffer.
      int len = 0;
      while ((len = inputStream.read(buffer)) != -1) {
          byteBuffer.write(buffer, 0, len);
      }

      // And then we can return your byte array.
      return byteBuffer.toByteArray();
  }

0 个答案:

没有答案