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:

  1. 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 to multipart and define the metadata of the media item. In the following sample, merely the media particular's title 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" }                              

  1. Use the backdrop of the link object to create the upload_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 the URL path.
True: Add value of the media.key at the cease of the URL path: http://{HOST}/{PATH/{MEDIA.Cardinal}
False: Add together value of the media.fundamental every bit video_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


  1. Determine the byte range of each media chunk.

  1. 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 multipart/form-data. If MIME blazon of the file cannot be determined, application/octet-stream may be used.

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 0. This means that the last byte is n-1, where due north is the total size of the file in bytes. Utilise this information when defining byte ranges.

X-Session-ID Resumable upload session ID

The session_id is returned in the Post /videos/create or POST /videos/update API call.

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 exist 52370333.

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"     }   } }                              

  • Protect your content with signed URLs

thomasroplegair.blogspot.com

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

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel