All Products
Search
Document Center

ApsaraVideo Media Processing:Query the details of a media asset

Last Updated:Aug 21, 2023

A media asset contains an input file and several output files. Input information includes the basic information and details of the input file. Output information includes the details of output videos and snapshots. This topic describes how to query the details of a media asset.

Query the details of a media asset

ApsaraVideo Media Processing (MPS) allows you to query the details of a media asset by using MPS SDKs or calling API operations. For more information about how to install MPS SDKs for different programming languages, see Install Alibaba Cloud SDK for Java, Install Alibaba Cloud SDK for Python, and Alibaba Cloud SDK for PHP. For more information about the sample code, see the following text. For more information about how to call API operations, see the Directly call API operations to query the details of a media asset section of this topic.

Note

In the following example, MPS SDK for PHP is used.

Use the SDK to call API operations to query the details of a media asset based on its media ID

<?php
namespace AlibabaCloud\SDK\Sample;

use AlibabaCloud\SDK\Mts\V20140618\Mts;
use AlibabaCloud\Darabonba\Env\Env;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Utils\Utils;
use AlibabaCloud\Tea\Console\Console;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Mts\V20140618\Models\QueryMediaListRequest;


class Sample {

    /**
     * @param string $accessKeyId
     * @param string $accessKeySecret
     * @param string $regionId
     * @return Mts
     * We recommend that you set the protocol parameter to HTTPS in a production environment.
     */
    public static function createClient($accessKeyId, $accessKeySecret, $regionId){
        $config = new Config([]);
        $config->accessKeyId = $accessKeyId;
        $config->accessKeySecret = $accessKeySecret;
        $config->regionId = $regionId;
        $config->protocol = "HTTP";
        return new Mts($config);
    }

    /**
     * @return void
     * The includePlayList parameter specifies whether to return the playback information.
     * The includeSnapshotList parameter specifies whether to return the information of snapshots.
     * The includeMediaInfo parameter specifies whether to return the information of the media files.
     * The includeSummaryList parameter specifies whether to return the summary.
     */
    public static function main(){
        $client = self::createClient(Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_ID"), Env::getEnv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), 'cn-shanghai');
        $request = new QueryMediaListRequest([
            "mediaIds" => "90accf23cb5c5fbc99****",
            "includePlayList" => true,
            "includeSnapshotList" => true,
            "includeMediaInfo" => true,
            "includeSummaryList" => true

        ]);
        $response = $client->queryMediaList($request);
        Console::log(Utils::toJSONString(Tea::merge($response->body)));
    }

}
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($path)) {
    require_once $path;
}
Sample::main();

Directly call API operations to query the details of a media asset

Note

You can directly call API operations in OpenAPI Explorer to query the details of a media asset.

The following table describes the API operations that are used to query the details of a media asset.

Feature

Operation

Query the details of a media asset based on its media ID

QueryMediaList

Query the details of a media asset based on its OSS URL

QueryMediaListByURL

Note

An OSS URL refers to the URL of a media file in an OSS bucket. Example: http://exampleBucket****.oss-cn-hangzhou.aliyuncs.com/test/video_01.mp4.