Answer the question
In order to leave comments, you need to log in
Facebook video upload using graph api v2.3 (Resumable Upload). Can anyone help?
There is an application on Qt, designed for uploading photos / videos to social networks. networks (including FB). Now it works on the old version of Api (2.1), hence the 1GB file size limit and regular HTTP 504s. So the task is to transfer it to v2.3 with resumable downloads.
I pass authorization successfully. Init download - too, I get all the necessary parameters. But loading the first chunk ends with the following error:
{"error":{"message":"Service temporarily unavailable","type":"FacebookApiException","is_transient":true,"code":2,"error_subcode":1363030,"error_user_title":"Video Upload Time Out","error_user_msg":"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."}}
QNetworkRequest request;
request.setUrl(QUrl(QString("https://graph-video.facebook.com/v2.3/me/videos")));
QHttpMultiPart *body = new QHttpMultiPart(QHttpMultiPart::FormDataType);
_file = new QFile(filename);
_file->open(QIODevice::ReadOnly);
QHttpPart tokenPart, phasePart, sessionPart, offsetPart, dataPart;
tokenPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"access_token\""));
tokenPart.setBody(accessToken.toUtf8());
phasePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"upload_phase\""));
phasePart.setBody(phaseTransfer.toUtf8());
sessionPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"upload_session_id\""));
sessionPart.setBody(_sessionId.toUtf8());
offsetPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"start_offset\""));
offsetPart.setBody(QString::number(_startOffset).toUtf8());
QHttpPart dataPart;
dataPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"video_file_chunk\""));
QByteArray data = _file->read(_endOffset - _startOffset);
dataPart.setBody(data);
body->append(tokenPart);
body->append(phasePart);
body->append(offsetPart);
body->append(sessionPart);
body->append(dataPart);
_server->post(request, body);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question