Upload from clients

Updated at:
Copy as MD

Client upload allows mobile apps to upload media files directly to ApsaraVideo VOD storage, bypassing the application server and saving server resources.

Feature overview

Client upload SDKs support local file and online file uploads.

Feature

Description

Note

Supported platforms

Web, iOS, Android, and WeChat mini program

N/A

Media files

  • Supported formats are listed in Media formats.

  • Supports local file and online file (URL-based) uploads.

    Note

    URL-based upload is supported only in the China (Shanghai) region.

  • Supports short video recording and upload.

  • Supports batch upload with add, delete, cancel, resume, traverse, and clear operations.

  • Local file: up to 48.8 TB in size.

  • Online file: up to 5 GB.

Note

URL-encode online file URLs to prevent failures from special characters.

Storage locations

Supports default or custom storage addresses.

Change the default storage address.

To specify a storage address, set the StorageLocation parameter when obtaining an upload URL and credential.

Media asset management

Supports metadata such as titles, tags, categories, and thumbnails.

To configure metadata, set Title, Tags, CateId, and CoverURL when obtaining an upload URL and credential.

Audio and video transcoding

Supports transcoding uploaded audio and video files with a specified template or workflow.

To transcode files, set TemplateGroupId and WorkflowId when obtaining an upload URL and credential.

Upload authorization

  • Supports the upload URL and credential method.

  • Supports the STS Token method.

The upload URL and credential method is recommended. Upload processes compares the two methods.

Upload control

Supports start, stop, pause, and resume.

The SDK handles resumable upload automatically. If an upload fails, it resumes from where it stopped.

Upload acceleration

To enable upload acceleration, submit a request on Yida.

After enabling, configure upload acceleration by setting the AccelerateConfig field in the UserData parameter.

Network type switching

Supports switching between mobile networks (3G/4G) and Wi-Fi.

To reduce mobile data usage, pause uploads on 3G/4G and resume on Wi-Fi.

Event notifications

Configure callbacks for upload event notifications. Supported events are listed in Media upload.

To set callbacks, see Callback configuration.

Upload processes

Client upload SDKs encapsulate the OSS SDK for object upload. Files upload directly to the ApsaraVideo VOD OSS bucket without server-side transfer.

You must deploy an authorization service on your application server. Two methods are supported: STS token-based authorization and credential-based authorization.

Credential-based authorization is recommended. It offers simpler and more flexible configuration, enhanced security, higher redundancy, and granular per-video permission control with multiple response parameters.

Credential-based authorization

The following figure shows the credential-based upload process.

image
  1. Deploy an authorization service (ApsaraVideo VOD SDK) on your application server to obtain upload URLs and credentials.

    Note

    API reference

  2. The client requests an upload URL and credential from the application server.

  3. The application server requests the upload URL and credential from ApsaraVideo VOD.

  4. ApsaraVideo VOD returns the upload URL and credential.

    Note
    • ApsaraVideo VOD also generates media IDs for use in 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. 

    • You can also set a callback for upload results.

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

  6. The client initializes an upload instance with the URL and credential.

  7. The client constructs upload parameters and sends the upload request.

  8. OSS returns the upload result.

STS token-based authorization

The following figure shows the STS token-based upload process.

image
  1. Deploy an authorization service (STS SDK) on your application server to obtain temporary STS tokens.

    Note

    API reference

    AssumeRole: Obtains an STS token to assume a Resource Access Management (RAM) role. Obtain an STS token.

  2. The client requests an STS token from the application server.

  3. The application server requests the token from STS.

  4. STS returns the token.

  5. The application server returns the STS token to the client.

  6. The client uses the STS token to request an upload URL and credential from ApsaraVideo VOD.

  7. ApsaraVideo VOD returns the upload URL and credential to the client.

  8. The client constructs upload parameters and sends the upload request.

  9. OSS returns the upload result.

Client-side integration

Integration varies by platform: