You can query information about media assets such as video, audio, and image files and specify the fields to return. Multiple query modes are supported, such as fuzzy match and multi-value query. You can also query, filter, and sort media asset information based on specific parameters. This topic describes how to query media asset information by using the ApsaraVideo VOD console, API, or SDK.
Methods
You can use the following two methods to query media asset information:
By using the ApsaraVideo VOD console
Log on to the ApsaraVideo VOD console and go to the Audio/Video page. You can filter audio and video files by type, category, status, and source. You can also search for media assets by media name, media ID, or tag name.
NoteIf a video file is in the Transcoding Failed status, delete the video file and upload the file again. If transcoding for the video file fails for multiple times, view the possible causes and the corresponding solutions in FAQ about transcoding.
By using the API operations or SDKs
Call the SearchMedia operation and use the search protocol to query media asset information. You can call the SearchMedia operation to query media asset information and specify the fields to return. Multiple query modes are supported, such as exact match, fuzzy match, multi-value query, and range query. You can filter media asset information based on VideoId, CateId, StorageLocation, Title, or Tags. For more information about the search syntax and rules, see Protocol for media asset search.
Limits
Paging limits
When you query media assets by using the API operations or SDKs, the SearchMedia operation returns only part of the data that meets the query conditions to avoid performance problems caused by deep paging. To obtain more data or traverse all data, you must use the ScrollToken
and SessionId
pagination identifiers.
Pagination parameters such as
PageNo
andPageSize
are used to obtain some data without passingScrollToken
orSessionId
. You can obtain the first 5,000 data records for one query.To obtain more data or traverse all data, you must use the
PageNo
andPageSize
pagination parameters and theScrollToken
andSessionId
pagination identifiers. Make sure that the number of data records on pages between the current page number and the required page number does not exceed 1,200. When you go to the page specified by the required page number, you can obtain the next 1,200 data records. Repeat the preceding operations to obtain all data. You can obtain data in multiple segments based on the pagination identifiers. However, you can obtain a maximum of 1,200 data records in each segment.
API call examples
The sample code in the following section describes the query statements used for querying video information.
Before you send a request, you must perform URL encoding on the request parameters.
The equal signs (=), double quotation marks ("), single quotation marks ('), and parentheses used in the statement must be single-byte characters.
Item | Description |
Return field | By default, the SearchMedia operation returns only basic media asset information. To obtain more media asset information, you must set the
Sample request:
|
Exact match | Query information about a video whose
Sample request:
|
Fuzzy match | Query media asset information where
or
Sample request:
|
Multi-value query | Note: If the fields used for the query only support fuzzy match, the query results are also returned based on fuzzy match. Query information about a media asset whose
Sample request:
|
Range query | Use an open or closed interval to indicate a time range. Query information about a media asset whose
Sample request:
Use a left-open or right-open interval to specify only the end time or start time of a time range. Query information about a media asset whose
Sample request:
|
Sort field | Sort media asset information in reverse chronological order based on the creation time:
Sample request:
|