All Products
Search
Document Center

CDN:Video seeking

Last Updated:Sep 12, 2023

Video seeking allows users to seek to a specific position without compromising the playback quality when they play video or audio content. This topic describes how to configure video seeking.

Background information

  • When a user seeks to a specific position in an on-demand video or audio file after you enable video seeking, the client sends a request that contains the URL of the video or audio file to the server.

    For example, the file is in the FLV format and the URL is www.aliyun.com/test.flv?start=10. The start parameter specifies the position that the user wants to seek to. After the server receives the request, the server seeks to the keyframe at the specific position and then returns the content that starts from this keyframe. If no keyframe exists at the specific position, the server seeks to the last keyframe before the specific position. The following table describes the supported file formats for video seeking and sample URLs.

    File format

    Metadata

    Start parameter

    Example

    MP4

    The metadata of a video file on the origin server must be included in the file header and not included in the file tail.

    The start parameter specifies the position. The start parameter supports only values in seconds. Decimals are supported, and the value is rounded to the third decimal point. For example, if you specify start=1.01, the position is at 1.01 seconds after the video file starts.

    • If the position that is specified by the start parameter is not a keyframe, Alibaba Cloud CDN automatically locates the last keyframe before the specific position.

    • If the position that is specified by the start parameter is a keyframe, Alibaba Cloud CDN automatically locates the keyframe.

    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 position. The start parameter supports only values in bytes. Decimals are not supported, and the value is rounded down to the nearest positive integer.

    • If the position that is specified by the start parameter is not a keyframe, Alibaba Cloud CDN automatically locates the last keyframe before the specified position.

    • If the position that is specified by the start parameter is a keyframe, Alibaba Cloud CDN automatically locates the keyframe.

    The request URL http:// domain/video.flv?start=10 specifies that the video is played from the 10th byte.

  • 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).

  • After you enable video seeking, the time to first byte (TTFB) is increased by about 30 ms.

Procedure

  1. Log on to the Alibaba Cloud CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.
    Domain Names
  4. In the left-side navigation pane of the domain name, click Video.
  5. In the Video Seeking section, turn on Video Seeking.

  6. Optional. Allow FLV files to be sought by time.

    Turn on Time-based FLV Seeking.

  7. Optional. Specify the names of the start and end time parameters.

    1. Click Custom Parameters to the right of Modify.

    2. In the Customize Parameters for Video Seeking dialog box, configure Start Parameter and End Parameter.

      Note
      • The default names of the start and end parameters are start and end.

      • Parameter names can contain letters, digits, and underscores (_). Examples: 123, aabbAABB, and aa_BB123.

      • If you turn on only Video Seeking, the unit of the start and end parameters is byte.

      • If you turn on Video Seeking and Time-based FLV Seeking, the unit of the Start and End parameters is second.

    3. Click OK.