I am creating facebook video ads with google app script, for this first I have to upload video with this endpoint: “https://graph-video.facebook.com/v19.0/pageId/videos”. complete code function is this:
`function uploadVideoChunk(pageId, uploadSessionId, startOffset, videoChunk) {
//return uploadFileFetch(pageId, uploadSessionId, startOffset, videoChunk)
var url = "https://graph-video.facebook.com/v19.0/" + pageId + "/videos";
var payload = {
"upload_phase": "transfer",
"access_token": page_access_token,
"upload_session_id": uploadSessionId,
"start_offset": startOffset,
"video_file_chunk": videoChunk
};
var options = {
"method": "POST",
"payload": payload,
"muteHttpExceptions": true
};
var response = UrlFetchApp.fetch(url, options);
var responseData = JSON.parse(response.getContentText());
console.log('upload Video Chunk responseData = ',responseData)
var newStartOffset = responseData.start_offset;
return newStartOffset;
}`
I am getting this error: Your video upload timed out before it could be completed. This is probably because of a slow network connection or because the video you’re trying to upload is too large. Please try again
could you please help how can I solve this.
Thank you
I am following this: https://developers.facebook.com/docs/video-api/guides/publishing/#step-2–upload-chunks-individually