What Is Video Upload Resumable on Facebook
You tin now use the Platform Management API v2 to upload your content.
Large video files can be uploaded using a resumable file upload protocol. This method allows to continue file upload simply for the remaining office of the file after a network interruption.
TIP
We strongly recommend using the s3 upload method over resumable uploads. In exercise, the CDN accelerated s3 uploads are the fastest and virtually reliable ways to get a file from a local system to JW Platform (even for unreliable or low bandwidth connections).
Use the following steps to upload your media:
- Make a Postal service /v1/videos/create (to create a new media object) or Post /v1/videos/update (to update an existing media object). Within the JSON body, set
upload_method
tomultipart
and define the metadata of the media item. In the following sample, merely the media particular'stitle
is divers.
curl -Ten POST https://api.jwplayer.com/v1/videos/create?api_nonce={API_NONCE}&api_timestamp={API_TIMESTAMP}&api_signature={API_SIGNATURE}&api_key={SITE_ID} \ -H 'Content-Type: application/json' \ -d '{ "upload_method": "multipart", "title": "My Uploaded Video" }'
The API phone call returns a response that includes a link
object.
{ "status": "ok", "media": { "type": "video", "central": "tL17msiU" }, "link": { "path": "/v1/videos/upload/resumable", "query": { "key": "vtQmcboj" }, "protocol": "http", "accost": "upload.jwplatform.com" }, "rate_limit": { "reset": 1572450240, "limit": sixty, "remaining": 59 }, "session_id": "kwJei9j2vtQmcbojrlGJY3mbJFMHfzZwPXBwoSQr" }
- Use the backdrop of the
link
object to create theupload_url
.
upload_url = link.protocol + "://" + link.address + link.path + "?api_format={1 of: py, json, xml, php}" + "&key=" + link.query.key
The above concatenation should produce an upload URL structure like to the following instance.
http://upload.jwplatform.com/v1/videos/upload/resumable?api_format=xml&fundamental=vtQmcboj
TIP
In addition to the parameters in the
link
block, you tin optionally add the following redirect query parameters to the upload URL:key_in_path
boolean
: Specifies if media.fundamental should be added as a query parameter to the redirect URL or at the end of theURL
path.
•True
: Add value of themedia.key
at the cease of the URL path:http://{HOST}/{PATH/{MEDIA.Cardinal}
•False
: Add together value of themedia.fundamental
every bitvideo_key
query parameter:http://{HOST}/{PATH}?video_key={MEDIA.Key}
Default is
False
.redirect_address
string
: Redirect accost string using the post-obit format:{PROTOCOL}://{HOST}/{PATH}
redirect_query.param
string
: Redirect query parameter.The
param
function of the redirect parameters (after the '.' separator) specifies proper name of the parameter. This query parameter tin can be specified multiple times, as long as parameter name is unique.The post-obit is an case upload URL that uses these redirect parameters:
http:// upload.jwplatform.com/v1/videos/upload/resumable
?api_format=json
&cardinal=vtQmcboj
&redirect_address=http:// instance.com/path
&redirect_query.parameter1=value1
&redirect_query.parameter2=value2
&key_in_path=True
- Determine the byte range of each media chunk.
- Upload each chunk to the upload URL. The request headers shown in the following example are required. The body of the request must comprise a clamper of the file that corresponds to the range specified in the
10-Content-Range
header.
POST /v1/videos/upload/resumable?api_format=xml&key=vtQmcboj&redirect_address=http://example.com/path&redirect_query.parameter1=value1&redirect_query.parameter2=value2&key_in_path=Truthful HTTP/1.one Host: upload.jwplatform.com Content-Length: 1234567 Content-Disposition: zipper; filename="video.mpeg" Content-Type: awarding/octet-stream 10-Content-Range: bytes 0-1234566/96768273 10-Session-ID: kwJei9j2vtQmcbojrlGJY3mbJFMHfzZwPXBwoSQr <bytes 0-1234566>
Header | Description |
---|---|
Content-Disposition | attachment; filename="{YOUR_FILE_NAME}" |
Content-Type | MIME type of a file being uploaded MIME type must not be set to |
X-Content-Range | Byte range of the clamper beingness uploaded and full size of the file in bytes using bytes <chunk_start_byte>-<chunk_end_byte>/<file_size> format Of import: The first byte of a file is |
X-Session-ID | Resumable upload session ID The |
Subsequently the upload server acknowledges a successful chunk upload with a 201 Created
HTTP status response, the side by side file chunk may be uploaded.
HTTP/1.1 201 Created Date: Wed, 08 Aug 2012 09:24:34 GMT Content-Length: 18 Range: 0-1234566/96768273 0-1234566/96768273
IMPORTANT
If the file upload is interrupted due to a network connection effect or a user-initiated pause, the client should resume the procedure past uploading the file chunk from the 0 byte position.
The upload server volition answer with the combined byte range received in the previous upload session(s). If the uploaded chunk was previously received, it volition exist discarded.
The customer must use the received byte range to determine the starting time byte for the next file chunk. For case, if the upload server responds with the received byte range
0-52370332/96768273
, the next file chunk start byte must exist52370333
.
Later on all parts take been uploaded, the API returns information virtually the uploaded video. The post-obit case includes redirect parameters.
{ "status": "ok", "video": { "cardinal": "tL17msiU", "size": 96768273 }, "redirect_link": { "address": "http://example.com/path/tL17msiU", "query": { "parameter1": "value1", "parameter2": "value2" } } }
Updated 6 months ago
Source: https://developer.jwplayer.com/jwplayer/docs/upload-videos-with-a-resumable-protocol
0 Response to "What Is Video Upload Resumable on Facebook"
Post a Comment