Configure video seeking

更新时间: 2026-04-18 16:45:15

Video seeking is a feature for on-demand video where the client sends a URL request to the server when you seek to a specific point in a video. This topic describes how to enable the video seeking feature in CDN.

Note

Enabling video seeking adds approximately 30 ms to the time to first byte (TTFB). This delay is typically not noticeable.

How it works

When video seeking is enabled, a request is sent to the server each time a user adjusts the playback position. The CDN identifies the nearest preceding keyframe to load the requested video segment, which provides a seamless playback experience.

Prerequisites

  • Your origin server supports HTTP Range requests.

  • The Ignore Parameters feature is disabled.

File formats and parameters

For example, if a client sends a URL request for an FLV file such as www.aliyun.com/test.flv?start=10, the server returns data that starts from the keyframe preceding the 10th byte. The following table describes the supported file formats and URL formats for video seeking.

File format

Metadata

Start parameter

Example

MP4

The video's metadata on the origin server must be in the file header. Videos with metadata at the end of the file are not supported.

The start parameter specifies the time in seconds and supports up to three decimal places. For example, start=1.01 indicates that playback starts at 1.01 seconds.

  • If the start time is not on a keyframe, CDN/ automatically seeks to the preceding keyframe.

  • If the start time is on a keyframe, CDN/ automatically seeks to that keyframe.

A URL request for domain/video.mp4?start=10 means playback starts from the 10th second.

FLV

The video on the origin server must contain metadata.

The start parameter specifies the offset in bytes. Decimals are not supported. If you specify a decimal value, the seeking module rounds it down to the nearest integer. If you enable Time-based FLV Seeking, the start and end parameters represent time in seconds.

Note

Byte-based seeking is suitable for precise data processing or raw video workflows, whereas time-based seeking offers a user-friendly experience by allowing jumps to a specific second.

  • If the start offset is not on a keyframe, CDN/ automatically seeks to the preceding keyframe.

  • If the start offset is on a keyframe, CDN/ automatically seeks to that keyframe.

A URL request for domain/video.flv?start=10 starts playback from the keyframe preceding the 10th byte.

Procedure

  1. Log on to the CDN console.

  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 Video Seeking section, turn on the Video Seeking switch.

  6. (Optional) Turn on Time-based FLV Seeking and configure Custom Parameters.

Handling drag-and-drop parameters

For example, when seeking by time, the default video seeking parameters are start and end. The following tables describe the processing logic for parameter values in different scenarios:

MP4 file requests

start/end value

Example

Handling Drag-and-Drop

Invalid start and invalid end

start=foo&end=bar

Ignores the video seeking parameters and responds with the complete video.

Valid start and invalid end

start=10

Drag-and-drop processing time for 10 files.

Invalid start and valid end

end=10

Processes video seeking from 0-10.

Valid start and valid end

start=0&end=10

Processes video seeking from 0-10.

start and end are both 0

start=0&end=0

Ignores the video seeking parameters and responds with the complete video.

start is greater than end

start=10&end=0

Drag-and-drop processing time for 10 files.

start is equal to end

start=10&end=10

Drag-and-drop processing: 10-file processing time.

start is greater than the video duration

start is greater than the video duration

Returns 400.

FLV file requests

start/end value

Example

Drag-and-drop handling logic

Invalid start and invalid end

start=foo&end=bar

Ignores the video seeking parameters and responds with the complete video.

Valid start and invalid end

start=10

Drag-and-drop processing: Duration for 10 files.

Invalid start and valid end

end=10

Processes video seeking from 0-10.

Valid start and valid end

start=0&end=10

You can process the range 0-10 by dragging and dropping.

start and end are both 0

start=0&end=0

Ignores the video seeking parameters and responds with the complete video.

start is greater than end

start=10&end=0

You can drag and drop a file with a length of 10 to process it.

start is equal to end

start=10&end=10

Handles drag-and-drop operations for 10 files.

start is greater than the video duration

start is greater than the video duration

Returns the complete video.

上一篇: Configure range origin fetch 下一篇: Configure audio extraction
阿里云首页 CDN 相关技术圈