All Products
Search
Document Center

ApsaraVideo VOD:Get started with ApsaraVideo VOD

Last Updated:Nov 27, 2025

ApsaraVideo VOD is an all-in-one solution that integrates media management, processing, and distribution. This guide shows how to build a secure, cost-effective, and production-ready video-on-dmand platform from scratch using ApsaraVideo VOD.

Before you begin

Log on to the ApsaraVideo VOD console and activate the service. You can choose either the pay-as-you-go or resource plan billing method. For more information, see Billing overview.

Note

ApsaraVideo VOD offers a free trial for new users to help you explore the service.

Region selection

ApsaraVideo VOD services are isolated by region. Choose a nearby region to reduce network latency and improve data transfer speeds. Supported features vary by region. For more information, see Service regions.

Solution setup

Step 1: Configure storage

  1. Go to the Storage page in the ApsaraVideo VOD console. From the menu bar at the top, select the region where you want to activate the service.image

  2. Click Enable VOD Buckets and select a redundancy type. For higher availability, select zone-redundant storage (ZRS).

    • ZRS

      Stores your data across multiple zones within the same region. This design ensures your data remains accessible even if a zone becomes unavailable.

    • Locally redundant storage (LRS)

      Stores your data on multiple devices across separate facilities within a single zone. This ensures data durability and availability in the event of hardware failure.

      Enabling a storage location may take some time. You can use the storage address only after its status changes to Normal.

Step 2: Upload audio and video files

Important

Configure a transcoding template group before you upload audio and video files. This ensures that versions in multiple definitions are automatically generated after the video is uploaded. This optimizes the playback experience and saves bandwidth.

  1. (Optional) Go to the Transcoding Template Groups page. Click Create Transcoding Template Group, set the required parameters, and save the configuration. For more information, see Transcoding.image

  2. Select an upload method.

    1. Upload using an SDK (Recommended for production environments)

      The backend service calls an SDK to obtain an upload credential. Then, the client, such as a web browser or an app, directly uploads the file to ApsaraVideo VOD. This is the most secure and efficient method.

      Note

      For code examples, see Overview of media upload.

      python# Python example: The backend service obtains an upload credential and address.
      from aliyunsdkvod.request.v20170321 import CreateUploadVideoRequest
      from aliyunsdkcore.client import AcsClient
      import json
      
      # 1. Initialize the client.
      # Replace the placeholders with your AccessKey ID, AccessKey secret, and region ID.
      client = AcsClient('your-access-key-id', 'your-access-key-secret', 'cn-shanghai')
      
      # 2. Create an API request and set the parameters.
      request = CreateUploadVideoRequest.CreateUploadVideoRequest()
      request.set_Title('My Test Video')
      request.set_FileName('video_test.mp4')
      # request.set_TemplateGroupId('your-transcode-template-group-id') # Optional. Specify a transcoding template.
      
      # 3. Send the request and obtain the response.
      response = client.do_action_with_exception(request)
      response_data = json.loads(response)
      
      # 4. Return UploadAddress and UploadAuth to the client.
      upload_address = response_data['UploadAddress']
      upload_auth = response_data['UploadAuth']
      video_id = response_data['VideoId']
      
      # After the client obtains the credential, use the upload SDK to upload the file.
    2. Upload using the console (Suitable for uploading a small number of small files or testing)

      Go to the Audio/Video page in the ApsaraVideo VOD console. Click Upload. Click Add Media. Select the local file, or drag the file to the area.image.png

    3. Batch upload from URLs (Suitable for offline site migration when files are not stored locally and can be accessed over the Internet). For more information, see Batch upload by pulling from URLs.

    4. Windows client (Suitable for batch uploading multiple large files). For more information, see Upload media files by using a PC client tool.

(Optional) Step 3: Configure an accelerated domain name

Streaming directly from a playback URL incurs charges based on storage outbound traffic. To reduce costs, configure an accelerated domain name. The acceleration service fee is lower than the fee for outbound traffic from storage. For more information, see Add an accelerated domain name.

Step 4: Play the media file

  1. Obtain a playback credential (Recommended for production environments)

    1. Backend API call

      The backend service needs to call an API to dynamically generate a time-limited playback credential (PlayAuth) for each playback request.

      python# Python example: Obtain a playback credential.
      from aliyunsdkvod.request.v20170321 import GetVideoPlayAuthRequest
      
      # The client has been initialized in the upload step.
      request = GetVideoPlayAuthRequest.GetVideoPlayAuthRequest()
      request.set_VideoId('your-video-id') # Replace the placeholder with the actual VideoId.
      request.set_AuthInfoTimeout(3000)  # The validity period of the credential in seconds. In this example, the period is 50 minutes.
      
      response = client.do_action_with_exception(request)
      play_auth = json.loads(response)['PlayAuth']
      
      # Return the obtained play_auth and video_id to the frontend.
    2. Frontend player integration

      The frontend player uses the vid and playAuth obtained from the backend to initialize playback.

      Web

      <!-- Web player example -->
      <div id="player-container"></div>
      <script src="https://g.alicdn.com/de/prismplayer/2.15.2/aliplayer-min.js"></script>
      
      <script>
        var player = new Aliplayer({
          id: 'player-container',
          width: '100%',
          height: '500px',
          vid: 'your-video-id',      // Obtained from the backend
          playauth: 'your-play-auth', // Obtained from the backend
          cover: 'https://your-domain.com/cover.jpg' // Thumbnail URL
        }, function (player) {
          console.log('The player is created.');
        });
      </script>

      Android

      1. Create a player.
      AliPlayer player = AliPlayerFactory.createAliPlayer(context);
      
      // 2. Configure the playback source.
      VidAuth vidAuth = new VidAuth();
      vidAuth.setVid("your-video-id");
      vidAuth.setPlayAuth("your-play-auth");
      vidAuth.setRegion("cn-shanghai"); // Set the region.
      
      // 3. Prepare for playback.
      player.setDataSource(vidAuth);
      player.prepare();

      iOS

      1. Create a player.
      let player = AliPlayer()
      
      // 2. Configure the playback source.
      let vidAuth = AVPVidAuthSource()
      vidAuth.vid = "your-video-id"
      vidAuth.playAuth = "your-play-auth"
      vidAuth.region = "cn-shanghai" // Set the region.
      
      // 3. Prepare for playback.
      player.setSource(vidAuth)
      player.prepare()
  2. URL signing

    URL signing appends the signature information to the URL. This method is less secure than using playback credentials. It is suitable for scenarios where modifying the player is inconvenient. For more information, see URL signing.

  3. Web player testing

    For testing and demonstration, you can also use the demo web player to play your media files.

    1. Go to the Audio/Video page in the ApsaraVideo VOD console. In the Actions column of the target video, click Manage.

    2. Select the Video URL tab. In the Actions column of the target definition, click Copy.image.png

    3. Use the playback URL in the web player to play the video.

References

  • Transcoding: Set a transcoding template to automatically transcode videos upon upload and generate outputs in multiple definitions.

  • Workflow: Set up a workflow to automatically perform video processing tasks, such as transcoding, taking snapshots, and adding watermarks, after a video is uploaded.

  • Video editing: Perform professional video editing online or using an API or SDK.

  • Add an accelerated domain name: Configure an accelerated domain name to speed up video uploads and downloads and receive traffic discounts.

FAQ

How do I upload meida files in batches?

You can upload multiple audio and video files at a time using a PC client, batch uploading from URLs, or an upload SDK. For more information, see Overview of media upload.

How do I migrate media files from OSS to ApsaraVideo VOD?

  1. You can add your OSS bucket to ApsaraVideo VOD if the following two conditions are met.

    • An OSS bucket of the Standard storage class exists in the destination region.

    • You have authorized ApsaraVideo VOD to access your OSS resources on the RAM Quick Authorization page.

  2. You can also prepare the source file addresses and use an upload tool for migration. For more information, see Overview of media upload.