Facebook fixed the problem under bug developers.facebook.com/bugs/791781120839901
restfb: encountering 504 while uploading video sized 950 mb
-
21-07-2023 - |
سؤال
Using restfb-1.6.12
Creating client as:
facebookClient = new DefaultFacebookClient(accessToken, new CustomWebRequestor(), new DefaultJsonMapper());
In CustomWebRequestor, customizeConnection() is overridden and following is specified:
connection.setChunkedStreamingMode(5242880);
Uploading video as:
facebookClient.publish("me/videos", FacebookType.class, BinaryAttachment.with(mediaFileName, mediaFileStream), Parameter.with("description", msg), Parameter.with("target_id", "me"), Parameter.with("metadata", 1));
Encountering following:
com.restfb.exception.FacebookNetworkException: A network error occurred while trying to communicate with Facebook: Facebook request failed (HTTP status code 504)
at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:625)
Upload happens as I can find the video on Facebook, but the reponse received from API doesn't tell me so. API works for videos of lesser size, like 400-500 MB. Recent change log doesn't mention any change around this either. Some help please.
المحلول 2
نصائح أخرى
Have you had a look at https://developers.facebook.com/docs/graph-api/reference/v2.0/user/videos#publish
There, Facebook states that
Videos must be encoded as
multipart/form-data
and published tograph-video.facebook.com
instead of the regular Graph API URL.
Also, other rules are
The aspect ratio of the video must be between 9x16 and 16x9, and the video cannot exceed 1024MB or 180 minutes in length
Does RestFB use the correct endpoint?