All Products
Search
Document Center

ApsaraVideo VOD:Obtain upload URLs and credentials

Last Updated:Dec 22, 2023

Before you upload media files from clients to an Object Storage Service (OSS) bucket in ApsaraVideo VOD, you must obtain the upload URLs and credentials. This topic describes how to obtain upload URLs and credentials when you use client upload SDKs to upload media files. The upload URLs and credentials are used to initialize upload instances.

Background information

Client upload SDKs support the following authorization methods:

  • Use an upload URL and credential.

  • Use a Security Token Service (STS) token.

Upload URLs and credentials are issued by ApsaraVideo VOD to authorize users to upload media files to OSS buckets in ApsaraVideo VOD. Compared with using an STS token, using upload URLs and credentials to upload media files is more beneficial. For more information, see Comparison between credentials and STS. For more information about how to obtain an STS token, see Obtain an STS token.

Upload process

Process of uploading a media file by using an upload URL and an upload credential

The following figure shows the complete process of uploading a media file by using an upload URL and an upload credential. In this example, ApsaraVideo VOD SDK is integrated to obtain the upload URL and credential.客户端SDK上传凭证上传流程

  1. A user deploys an authorization service on an application server, such as ApsaraVideo VOD SDK, to obtain upload URLs and credentials.

  2. A client sends a request to the application server to request an upload URL and an upload credential.

  3. The application server sends a request to ApsaraVideo VOD to request the upload URL and credential.

  4. ApsaraVideo VOD returns the upload URL and credential.

    Note

    ApsaraVideo VOD also generates media IDs, which can be used in media lifecycle management and media processing.

    • For a video, the media ID is returned in the VideoId parameter.

    • For an image, the media ID is returned in the ImageId parameter.

    • For an auxiliary media asset, the media ID is returned in the MediaId parameter.

    • Properly keep the returned media IDs, which are required in subsequent tasks, such as media asset management, audio and video playback, and media processing.

  5. The application server returns the upload URL and credential to the client.

    Note

    The application server does not need to perform Base64 decoding on the upload URL or credential.

  6. The client uses the upload URL and credential to initialize an upload instance.

  7. The client constructs upload parameters to send an upload request.

  8. OSS returns the upload result.

    Note

    You can also set callbacks in advance to receive notifications about upload events.

Obtain upload URLs and credentials

We recommend that you call API operations by using the ApsaraVideo VOD SDK to obtain the upload URL and credential. This frees you from complex signature calculations. The process varies based on the programming language that you use.

This topic uses ApsaraVideo VOD SDKs for Java and Python V1.0 as examples. To use ApsaraVideo VOD SDK for other programming languages or ApsaraVideo VOD SDKs V2.0 to obtain upload URLs and credentials, follow the similar logic to call API operations. For more information, see Overview.

Language

References

Java

  1. Installation

  2. Initialization

  3. Media upload

Python

  1. Installation

  2. Initialization

  3. Media upload

Use upload URLs and credentials

Each file is bound to an upload URL and an upload credential. Therefore, you must obtain the upload URL and credential issued by the application server from the onUploadStarted callback and specify the upload URL and credential in the upload instance. The specific settings vary based on different clients.

Client

References

Web

Upload SDK for JavaScript

Android

Upload SDK for Android

iOS

Upload SDK for iOS

WeChat mini program

Upload SDK for WeChat mini programs