Video seeking allows users to seek a specified position without the need to compromise the playback quality when they play video or audio content. This topic describes how to configure video seeking.
Background information
After video seeking is enabled, when a user seeks a specified position on the video
or audio content on demand, the client sends a request to the server. The request
contains the URL of the video or audio file, for example, http://www.aliyun.com/test.flv?start=10
. The start parameter specifies the position that the user wants to seek. After the
server receives the request, it seeks the keyframe at the specified position and then
returns the content that starts from this keyframe. If no keyframe can be found at
the specified position, the server seeks the last keyframe before the specified position.
Before you configure video seeking, make sure that the origin server supports HTTP range requests. If an HTTP request includes the Range header field, the origin server returns an HTTP 206 status code (partial content message).
File format | Metadata | Start parameter | Example |
---|---|---|---|
MP4 | The metadata of a video file on the origin server must be contained in the file header and cannot be contained in the file tail. | The start parameter specifies the position. If the position specified by the start parameter is not a keyframe, Alibaba Cloud Content Delivery Network (CDN) automatically locates the last keyframe before the specified position. The start parameter supports only values in seconds. Decimals are supported. For example, if you specify start=1.01, the position is at 1.01 seconds after the video file starts. | The request URL http://domain/video.mp4?start=10 specifies that the video is played from the 10th second.
|
FLV | Video files on the origin server must contain metadata. | The start parameter specifies the byte. If the byte specified by the start parameter is not a keyframe, Alibaba Cloud CDN automatically locates the last keyframe before the specified byte. | The request URL http:// domain/video.flv?start=10 specifies that the video is played from the 10th byte.
|