All Products
Search
Document Center

ApsaraVideo VOD:Multiple video sources

Last Updated:Sep 09, 2026

A video source is a fundamental data module in AliPlayerKit. It defines multiple video source types and supports three playback methods: VidAuth, VidSts, and URL. This enables unified configuration and management of video resources.

Supported video source types

VidAuth mode (recommended)

This mode authorizes playback using a video ID and a playAuth. Use this mode for scenarios that require a simple authorization mechanism.

// Example: Create playback data with VidAuth
final videoSource = VideoSourceFactory.createVidAuthSource(
  vid: "<your-video-id>",
  playAuth: "<your-play-auth>",
);
final data = AliPlayerWidgetData(
  videoSource: videoSource,
);

VidSts mode

This mode uses a video ID (VID) and an Alibaba Cloud STS (Security Token Service) token for playback, providing enhanced security and access control.

// Example: Create playback data with VidSts
final videoSource = VideoSourceFactory.createVidStsSource(
  vid: "<your-video-id>",
  accessKeyId: "<your-access-key-id>",
  accessKeySecret: "<your-access-key-secret>",
  securityToken: "<your-security-token>",
  region: "<your-region>",
);
final data = AliPlayerWidgetData(
  videoSource: videoSource,
);

URL mode

This mode plays a video directly from a provided URL. Use this mode for publicly accessible video resources.

// Example: Create playback data with a URL
final videoSource = VideoSourceFactory.createUrlSource(
  "<your-video-url>",
);
final data = AliPlayerWidgetData(
  videoSource: videoSource,
);

Usage

When configuring the player, set the video source using the videoSource property of AliPlayerWidgetData:

// 1. Create a video source for the player.
final videoSource = VideoSourceFactory.createVidAuthSource(
  vid: "<your-video-id>",
  playAuth: "<your-play-auth>",
);

// 2. Configure the data for the player widget.
final data = AliPlayerWidgetData(
  videoSource: videoSource,
  videoTitle: "<your-video-title>",
);

// 3. Initialize the player widget controller.
_controller = AliPlayerWidgetController();
_controller.configure(data);

Notes

  1. Select the video source type that best fits your business scenario and requirements.

  2. The VidAuth and VidSts modes provide higher security and are recommended for scenarios that require authorization.

  3. The URL mode is simple to use and well-suited for public resources, but it offers less security.