2016-10-06 5 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();