This repository was archived by the owner on Jan 13, 2022. It is now read-only.
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Resumable upload to fb page returns error "There was a problem uploading your video. Please try again." code : 6001 #1000
Closed
Description
try {
$response = $fb->uploadVideo('me', $videoPath, $data, $token);
} catch (FacebookResponseException $e) {
// When Graph returns an error
return 'error_code-'. $e->getCode() . ' ' . $e->getMessage();
} catch (FacebookSDKException $e) {
// When validation fails or other local issues
return 'error_code-'. $e->getCode() . ' ' . $e->getMessage();
}
********************* SDK RESUMABLE UPLOAD CODE********************
public function uploadVideo($target, $pathToFile, $metadata = [], $accessToken = null, $maxTransferTries = 5, $graphVersion = null)
{
$accessToken = $accessToken ?: $this->defaultAccessToken;
$graphVersion = $graphVersion ?: $this->defaultGraphVersion;
$uploader = new FacebookResumableUploader($this->app, $this->client, $accessToken, $graphVersion);
$endpoint = '/'.$target.'/videos';
$file = $this->videoToUpload($pathToFile);
$chunk = $uploader->start($endpoint, $file);
do {
$chunk = $this->maxTriesTransfer($uploader, $endpoint, $chunk, $maxTransferTries);
} while (!$chunk->isLastChunk());
return [
'video_id' => $chunk->getVideoId(),
'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata),
];
}
Metadata
Metadata
Assignees
Labels
No labels