Obtaining upload URLs and credentials is a key step in ApsaraVideo VOD. This topic describes the usage notes and limits of upload URLs and credentials. This topic also describes how to obtain and parse upload URLs and credentials.
How it works
An upload URL specifies the storage address of a media file. An upload credential authorizes you to upload a media file to ApsaraVideo VOD. ApsaraVideo VOD issues upload URLs and credentials to perform authorization and ensure security. This prevents unauthorized users from uploading media files. ApsaraVideo VOD generates media IDs together with upload URLs and credentials. Media IDs are used in lifecycle management and media processing.
Media IDs include VideoId and ImageId. You can use media IDs in the following scenarios:
Manage the lifecycle of media files after they are uploaded. After you upload a media file by using the upload URL and upload credential, the initial status of the media file is Uploading. The status of the media file automatically changes to Uploaded, Transcoding, or Normal based on the operations that you perform.
Perform operations such as transcoding, snapshot capture, AI processing, and editing on media files.
An upload URL and an upload credential can be used only for a single media file, such as an audio, video, or image file.
If you send repeated requests to obtain an upload URL and an upload credential for the same video, different upload URLs and credentials are issued.
Upload URLs are automatically issued by ApsaraVideo VOD. You cannot specify upload URLs.
Upload credentials have a validity period of 3,000 seconds (50 minutes).
Uploading a video file may take a long time due to its large size. In this case, you must update the upload credential after it expires. The updated upload credential remains valid for 3,000 seconds and the upload URL is not changed.
For images and auxiliary media assets such as watermarks and subtitle files, you must obtain a new upload credential when the old one expires.
To upload videos, images, and auxiliary media assets, you must call different API operations to obtain upload URLs and credentials. You need to manually obtain upload URLs and credentials only when you use specific upload methods. For more information, see the following table.
In specific scenarios, you can also use Security Token Service (STS) tokens to access ApsaraVideo VOD. For more information about the differences between the two access methods, see Comparison between credentials and STS. The following content describes the differences between the two access methods:
If you use an upload credential to upload a media file, you can pass the AccessKey pair of your Alibaba Cloud account or a RAM user to construct the upload request.
If you use an STS token to upload a media file, you need to pass the STS token that you obtained in advance. For more information, see STS tokens.
Whether you need to manually obtain upload URLs and credentials
Whether you need to manually parse upload URLs and credentials
The server upload SDKs support only the following programming languages:
You only need to issue the obtained upload URLs and credentials to clients.
In this method, you must integrate the ApsaraVideo VOD SDK to obtain an upload URL and an upload credential. Then, use the obtained upload URL and credential to initialize the OSS SDK and upload media files.
Obtain upload URLs and credentials
You can obtain upload URLs and credentials by using one of the following methods:
For more information about the sample code of each upload method, click the upload method in the Usage notes section.
(Recommended) Call API operations encapsulated in the ApsaraVideo VOD SDK to obtain upload URLs and credentials. For more information, see Overview.
SDK sample code
Parse upload URLs and credentials
If you upload media files by using the OSS SDK or API, you must manually parse upload URLs and credentials. If you use other upload methods, you do not need to parse upload URLs or credentials.
You can decode the Base64-encoded values of the uploadAddress and uploadAuth parameters to obtain upload URLs and credentials. For more information, see Upload media files by using OSS SDKs.