Android facebook sdk4.0上传视频提示无法构建请求体

时间:2017-04-28 05:09:59

标签: android facebook-graph-api

GraphRequest graphRequest =GraphRequest.newGraphPathRequest(accessToken,"/me/videos",newGraphRequest.OnProgressCallback() {
                    @Override
                    public void onProgress(long current, long max) {

                    }

                    @Override
                    public void onCompleted(GraphResponse response) {
                        Log.i(TAG, "onCompleted: " + response.toString());
                    }
                });
        Bundle params = graphRequest.getParameters();
        try {
            byte[] data = readBytes(videoPath);
            Log.i(TAG, "shareVideoFB: " + data.length);
            params.putByteArray("video.mp4", data);
            String albumName = "testFBUpload";
            params.putString("title", albumName);
            params.putString("description", " SomeTag");
            params.putBoolean("spherical", true);
            graphRequest.setParameters(params);

            graphRequest.setHttpMethod(HttpMethod.POST);
            graphRequest.executeAsync();
        } catch (Exception e) {
            e.printStackTrace();
        }
}

0 个答案:

没有答案