Audio and video preview

更新时间: 2026-04-01 06:03:27

Audio and video preview lets CDN edge nodes return a time-limited portion of an audio or video file instead of the full file. This is used in video-on-demand (VOD) services to give non-premium users a free trial before they subscribe.

Supported formats

FormatSupportNotes
TSSupportedConfigure using this feature
MP3SupportedConfigure using this feature
FLVNot supportedUse video seeking with the end parameter instead
MP4Not supportedUse video seeking with the end parameter instead
HLSNot natively supportedSubmit a ticket to request configuration

How it works

When a client sends a request with a preview duration parameter, the CDN edge node returns only the specified portion of the file. For example:

http://example.com/sample.ts?free_time=15

This returns the first 15 seconds of sample.ts. The parameter name and value you configure in the console must match exactly what your client sends in the request URL.

Parameter behavior:

ScenarioBehavior
Parameter name set, no default value configuredEdge node returns the duration specified in each incoming request
Client requests longer than the total preview lengthThe total preview length takes effect. To avoid a shorter preview than intended, request slightly longer than the target — for example, request 15 seconds to preview 13 seconds of content

Enable audio and video preview

Procedure

  1. Log on to the .

  2. In the left navigation pane, click Domain Names.

  3. On the Domain Names page, find the target domain name and click Manage in the Actions column.

  4. In the domain's navigation pane, click Video.

  5. In the Audio/video Preview section, turn on Audio/video Preview and set Custom Preview Parameter. Set Custom Preview Parameter to the query parameter name your client uses in requests. The value is the preview duration in seconds. For example, if you set Custom Preview Parameter to free_time and a client sends free_time=15, the edge node returns 15 seconds of the requested file.

    Enable audio and video preview

  6. Click OK.

What's next

To configure preview for FLV or MP4 files, see Configure video seeking.

API reference

BatchSetCdnDomainConfig

上一篇: Configure audio extraction 下一篇: Configure standard M3U8 encryption and rewrite
阿里云首页 CDN 相关技术圈