2016-10-06 13 views
0

FacebookのSDKとグラフAPIを使用して動画をアップロードしようとしていますAndroid用Facebook SDK:動画のアップロードに失敗しました

これは有効な認証トークンを取得した後です。

{ Response: responseCode: 400, graphObject: null, error: {
HttpStatus: 400, errorCode: 390, errorType: OAuthException,
errorMessage: There was a problem uploading your video file. Please try again. } }

私が間違っているのは何:

Bundle params = new Bundle(); 
    params.putString("source", AssetsUtils.getExportMoviePath(this)); ///data/user/0/com.bundlecomp.appname/files/export.mp4 
    params.putString("name", "TestName"); 
    params.putString("title", "TestTitle"); 
    params.putString("filename", "export.mp4"); 
    params.putString("description", "Created with http://wwww.test.tu"); 
    Log.d(TAG, "Posting on user wall"); 
    new GraphRequest(
      AccessToken.getCurrentAccessToken(), 
      "me/videos", 
      params, 
      HttpMethod.POST, 
      new GraphRequest.Callback() { 
       public void onCompleted(GraphResponse response) { 
        Log.d(TAG, "GOT response from facebook. Error : " + response.getRawResponse()); 
        Log.d(TAG, "GOT response from facebook. Error : " + response.getError()); 
        Log.d(TAG, "GOT response from facebook. Resp : " + response); 

        runOnUiThread(new Runnable() { 
         @Override 
         public void run() { 
          finish(); 
          Log.d(TAG, "Posted"); 

         } 
        }); 
       } 
      } 
    ).executeAsync(); 

は、しかし、私は次のエラーを取得しますか?ここで

+0

ルックスは、私のソースではなく、パスのデータでなければなりませんが好きです... – Antzi

答えて

1

は、私が使用したものである:

Bundle params = new Bundle(); 
    try { 
     params.putByteArray("video.mp4", Files.toByteArray(new File(AssetsUtils.getExportMoviePath(this)))); 
    } catch (IOException pE) { 
     pE.printStackTrace(); 
    } 
    params.putString("name", "TestName"); 
    params.putString("title", "TestTitle"); 
    params.putString("filename", "video.mp4"); 
    params.putString("description", "Created with http://wwww.test.tu"); 
    Log.d(TAG, "Posting on user wall"); 
    new GraphRequest(
      AccessToken.getCurrentAccessToken(), 
      "me/videos", 
      params, 
      HttpMethod.POST, 
      new GraphRequest.Callback() { 
       public void onCompleted(GraphResponse response) { 
        runOnUiThread(new Runnable() { 
         @Override 
         public void run() { 
          finish(); 
          Log.d(TAG, "Posted"); 

         } 
        }); 
       } 
      } 
    ).executeAsync(); 
関連する問題