Upload videos with AWS S3

👍

IMPORTANT

S3 file uploads are limited to files less than 5GB in size and must have a minimum duration of 2 seconds. For larger files, use on of the following upload methods:

   • Upload with a resumable protocol
  • Upload multiple videos via URL
  • Upload files

Video files can be uploaded to AWS S3. This method will improve upload speed by using geographically closest S3 server and Amazon’s S3 Transfer Acceleration technology.


Upload media

Use the following steps to upload your media:

  1. Make a POST /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 s3 and define the title of the media item. In the following sample, only the media item's title is defined.
curl -X 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": "s3", "title": "My Uploaded Video" }'

The API call returns a response that includes a link object.

{
  "status": "ok",
  "media": {
    "type": "video",
    "key": "tL17msiU"
  },
  "link": {
    "path": "/path",
    "query": {
      "AWSAccessKeyId": "AKIAIRXCJ3TPZA4HVNYZ",
      "Expires": 1482770374,
      "Signature": "1/l+L6/yOE05dNEbXHW8sw7TGF4"
    },
    "protocol": "https",
    "address": "upload-s3.jwplatform.com"
  },
  "rate_limit": {
    "reset": 1572450420,
    "limit": 60,
    "remaining": 59
  }
}

📘

TIP

To more easily upload your videos, you can use one of our client libraries.


  1. Use the properties of the link object to create the upload_url.
upload_url = link.protocol + "://" + link.address + link.path +
    "?AWSAccessKeyId=" + link.query.AWSAccessKeyId +
    "&Expires=" + link.query.Expires +
    "&Signature=" + urlencode(link.query.Signature)

The above concatenation should produce an upload URL with a similar structure as the following example.

https://upload-s3.jwplatform.com/tL17msiU?AWSAccessKeyId=AKIAIRXCJ3TPZA4HVNYZ&Expires=1482770374&Signature=1%2Fl%2BL6%2FyOE05dNEbXHW8sw7TGF4%3D

  1. Upload the local media file to the upload_link location.
curl --request PUT --upload-file {PATH_TO_FILE} "{upload_url}"

  1. After the uploading process has completed, make a GET /v2/sites/YOUR_SITE_ID/media/{media_id} call to retrieve the media transcoding status.
curl -X GET https://api.jwplayer.com/v2/sites/{YOUR_SITE_ID}/media/{media_id} \
 -H 'Authorization: Bearer {YOUR_V2_API_SECRET}' \
 -H 'Content-Type: application/json'


Did this page help you?