Configure video seeking
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.
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.
| A URL request for |
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.
| A URL request for |
Procedure
-
Log on to the CDN console.
-
In the left navigation pane, click Domain Names.
-
On the Domain Names page, find the target domain name and click Manage in the Actions column.
-
In the domain's navigation pane, click Video.
In the Video Seeking section, turn on the Video Seeking switch.
(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 |
|
Ignores the video seeking parameters and responds with the complete video. |
|
Valid |
|
Drag-and-drop processing time for |
|
Invalid |
|
Processes video seeking from |
|
Valid |
|
Processes video seeking from |
|
|
|
Ignores the video seeking parameters and responds with the complete video. |
|
|
|
Drag-and-drop processing time for |
|
|
|
Drag-and-drop processing: |
|
|
|
Returns |
FLV file requests
|
start/end value |
Example |
Drag-and-drop handling logic |
|
Invalid |
|
Ignores the video seeking parameters and responds with the complete video. |
|
Valid |
|
Drag-and-drop processing: Duration for |
|
Invalid |
|
Processes video seeking from |
|
Valid |
|
You can process the range |
|
|
|
Ignores the video seeking parameters and responds with the complete video. |
|
|
|
You can drag and drop a file with a length of |
|
|
|
Handles drag-and-drop operations for |
|
|
|
Returns the complete video. |