VideoCaptions
GET /v21.0/{video-id}/captions HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/{video-id}/captions',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
"/{video-id}/captions",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{video-id}/captions",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{video-id}/captions"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Reading from this edge will return a JSON formatted result:
{ "
data
": [], "paging
": {} }
data
paging
Error | Description |
---|---|
104 | Incorrect signature |
100 | Invalid parameter |
To update a video's caption, you need one of the following:
The file size limit for video captions is 200K.
/{video_id}/captions
.Parameter | Description |
---|---|
captions_file file | Caption file in SRT (SubRip Text) format. File name must be in the format filename.locale.srt |
default_locale string | Specify which locale should be used as the default for the video. Can be set to 'none' |
locales_to_delete list<string> | Default value: Vector locales of caption to delete |
success
: bool, Error | Description |
---|---|
482 | The captions files you selected contain locales that had been applied to video, please remove and try again. |
387 | There was a problem uploading your captions file. Please try again. |
386 | You uploaded a .SRT file with an incorrect file name. Please use this format: filename.en_US.srt |
200 | Permissions error |