In on-demand video/audio streaming scenarios, the video processing feature of ESA provides a seamless playback experience by identifying the nearest previous keyframe to the requested playback position and loading the corresponding video segment.
Prerequisites
The origin server supports HTTP Range requests.
The query string is set to Retain All.
Add a video processing rule
In the ESA console, choose Websites and click the target site in the Website column.
In the navigation pane on the left, choose .
Select the Video Processing tab, click Create Rule, and then enter a Rule Name.
In the If requests match... area, set the conditions for matching user requests. For more information about how to configure rules, see Composition of rule expressions.
In the Video Seeking area, click Configure, turn on the Status switch, and then configure the parameters.

For example, if a URL request for an FLV file is
www.aliyun.com/test.flv?start=10, the server returns data starting from the keyframe that precedes the 10th byte. The following table describes the file and URL formats that the video seeking feature supports.File format
Meta information
Parameters
Example
MP4
The meta information of the source video must be in the file header. Videos with meta information at the end of the file are not supported.
The start parameter specifies the time in seconds. It supports up to three decimal places. For example, start=1.01 indicates that playback starts at 1.01 seconds.
If the time specified by start is not a keyframe, ESA automatically locates the previous keyframe.
If the time specified by start is a keyframe, ESA automatically locates the current keyframe.
Custom MP4 Parameters notes:
The start parameter is
startby default, and the end parameter isendby default.Custom parameters can contain only uppercase letters, lowercase letters, digits, and underscores (
_). For example:123,aabbAABB, andaa_BB123.
A URL request is
domain/video.mp4?start=10, which indicates that the video playback starts from the 10th second.FLV
The source video must contain meta information.
The start parameter specifies the byte. Decimals are not supported. Although you can specify a decimal in the parameter, the video seeking module rounds it down to a positive integer.
FLV Seeking By Time: The unit for the start and end parameters is seconds.
Seeking By Byte: Seeking by byte is suitable for precise data processing or processing raw video data. Seeking by second provides a user-friendly experience by directly jumping to the requested second.
If the time specified by start is not a keyframe, ESA automatically locates the previous keyframe.
If the time specified by start is a keyframe, ESA automatically locates the current keyframe.
Notes On Custom Parameters For Video Seeking:
The start parameter is
startby default, and the end parameter isendby default.Custom parameters can contain only uppercase letters, lowercase letters, digits, and underscores (
_). For example:123,aabbAABB, andaa_BB123.
A URL request is
domain/video.flv?start=10, which indicates that the video playback starts from the keyframe before the 10th byte.
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. |
References
Rule-related features vary in execution priority, rule behavior, and configuration scope. For more information, see How ESA rules take effect.