Uploading a Video

The first step is to upload a video.

To upload a video:

  1. Use the /v2/assets route. The following example creates the "My Video" video.
    Note: To upload the entire file at once, do not specify a chunk_size.
    [POST]/v2/assets{  
       "name":"My Video",
       "file_name":"my_video.avi",
       "asset_type":"video",
       "file_size":199895,
       "chunk_size":100000
    }

    Backlot returns a response similar to the following.

    {  
       "description":null,
       "duration":"0",
       "hosted_at":null,
       "name":"My Video",
       "updated_at":"2014-12-04T17:35:59Z",
       "time_restrictions":null,
       "external_id":null,
       "original_file_name":"my_video.avi",
       "asset_type":"video",
       "publishing_rule_id":"c9e230323e0642dfb5f945f8a6e247a9",
       "created_at":"2014-12-04T17:35:59Z",
       "embed_code":"cwYXIzcjoplcADLs9fdyZnUiRnl9pbbB",
       "status":"uploading",
       "player_id":"55375aa44474d6283028754ff3c4449",
       "preview_image_url":null,
       "ad_set_id":null
    }
  2. Get the uploading URLs.

    The following example gets the uploading URLs for the asset identified with the embed code cwYXIzcjoplcADLs9fdyZnUiRnl9pbbB.

    [GET]/v2/assets/cwYXIzcjoplcADLs9fdyZnUiRnl9pbbB/uploading_urls

    Backlot returns a response similar to the following.

    [  
       "https://uploader-v2.ooyala.com/send?filename=Y1dTdvMjq9QtOMGrP-H59OIgiZ6-_Mrl/0000000000000-0000000099999&filesize=100000&expires=1311447448&signature=tUp+iEUq9O9oP6khuasvZVFecoECcoej0gycG/ZTZr0",
       "https://uploader-v2.ooyala.com/send?filename=Y1dTdvMjq9QtOMGrP-H59OIgiZ6-_Mrl/0000000100000-0000000199894&filesize=99895&expires=1311447448&signature=1aJ3ojLTUDnfLiHxZt/1us7jZ0StbtMC+pOnqNSQtiw"
    ]
  3. Upload each chunk.
    Note: If you didn't specify a chunk size, do not specify a chunk range.
    The following example uploads the first chunk of the Y1dTdvMjq9QtOMGrP-H59OIgiZ6-_Mrl asset.
    [PUT]https://uploader-v2.ooyala.com/send?filename=Y1dTdvMjq9QtOMGrP-H59OIgiZ6-_Mrl/0000000000000-0000000099999&filesize=100000&expires=1311447448&signature=tUp+iEUq9O9oP6khuasvZVFecoECcoej0gycG/ZTZr0
    <file>
  4. Mark the video as uploaded. The following example marks the Y1dTdvMjq9QtOMGrP-H59OIgiZ6-_Mrl asset as uploaded.
    [PUT]/v2/assets/Y1dTdvMjq9QtOMGrP-H59OIgiZ6-_Mrl/upload_status{  
       "status":"uploaded"
    }

    Backlot returns a response similar to the following.

    {  
       "status":"uploaded"
    }

The video is successfully uploaded.

해당 내용이 도움 되었습니까?