日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

截圖任務

通過閱讀本文,您可以了解通過服務端SDK調用OpenAPI發起并查詢智能媒體服務截圖任務的示例代碼。

使用說明

發起截圖任務前,需要先創建截圖模板。通過TemplateId(截圖模板ID)發起截圖任務,發起截圖任務時,支持對截圖模板參數進行覆蓋重置,截圖任務處理成功后,可以根據返回的JobId(任務ID)查詢該截圖任務的詳細信息、截圖任務列表及截圖的訪問URL。

示例代碼

您可以通過阿里云OpenAPI開發者門戶在線調試。

<?php

require_once '../vendor/autoload.php';

use AlibabaCloud\SDK\ICE\V20201109\ICE;
use AlibabaCloud\SDK\ICE\V20201109\Models;
use AlibabaCloud\SDK\ICE\V20201109\Models\ListSnapshotJobsRequest;
use AlibabaCloud\SDK\ICE\V20201109\Models\GetSnapshotUrlsRequest;
use AlibabaCloud\SDK\ICE\V20201109\Models\GetSnapshotJobRequest;
use AlibabaCloud\SDK\ICE\V20201109\Models\CreateCustomTemplateRequest;
use AlibabaCloud\SDK\ICE\V20201109\Models\SubmitSnapshotJobRequest;
use AlibabaCloud\SDK\ICE\V20201109\Models\SubmitSnapshotJobRequest\output;
use AlibabaCloud\SDK\ICE\V20201109\Models\SubmitSnapshotJobRequest\input;
use AlibabaCloud\SDK\ICE\V20201109\Models\SubmitSnapshotJobRequest\templateConfig;
use Darabonba\OpenApi\Models\Config;

try {

    // 阿里云賬號AccessKey擁有所有API的訪問權限,建議您使用RAM用戶進行API訪問或日常運維。
    // 本示例以將AccessKey ID和 AccessKey Secret保存在環境變量為例說明。配置方法請參見:http://bestwisewords.com/document_detail/311677.html
    $credential = new Credential([]);
    $config = new Config([
     'credential' => $credential,
     'endpoint' => 'ice.cn-shanghai.aliyuncs.com'
    ]);
    // 如需硬編碼AccessKey ID和AccessKey Secret,代碼如下,但強烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導致AccessKey泄露,威脅您賬號下所有資源的安全。
    // $config->accessKeyId = '<yourAccessKeyId>';
    // $config->accessKeySecret = '<yourAccessKeySecret>';
    $client = new ICE($config);

    // 創建截圖模板
    $snapshotTemplateConfig = "{\"Type\":\"Normal\",\"FrameType\":\"normal\",\"Time\":0,\"Count\":10}";
    $request = new CreateCustomTemplateRequest();
    $request->name = "sdk_sample_snapshot_template";
    $request->type = 2;
    $request->templateConfig = $snapshotTemplateConfig;
    $response = $client->createCustomTemplate($request);
    echo json_encode($response->body);

    // 發起截圖任務
    $request = new SubmitSnapshotJobRequest();
    $request->name = "sdk_sample_snapshot_job";
    $request->input = new input(["type" => "Media","media" => "3945e42d01823498****"]);
    $request->output = new output(["type" => "Media","media" => "3945e42d01823498****"]);
    $request->templateConfig = new templateConfig(["templateId" => "4945e09631823498****"]);
    $response = $client->submitSnapshotJob($request);
    echo json_encode($response->body);

    // 查詢截圖任務詳細信息
    $request = new GetSnapshotJobRequest();
    $request->jobId = "20b48fb04483915d4f2cd8ac****";
    $response = $client->getSnapshotJob($request);
    echo json_encode($response->body);

    // 獲取截圖任務列表
    $request = new ListSnapshotJobsRequest();
    $request->pageSize = 5;
    $response = $client->listSnapshotJobs($request);
    echo json_encode($response->body);

    // 獲取截圖任務輸出圖片的訪問URL
    $request = new GetSnapshotUrlsRequest();
    $request->pageSize = 5;
    $request->jobId = "20b48fb04483915d4f2cd8ac****";
    $response = $client->getSnapshotUrls($request);
    echo json_encode($response->body);

} catch (TeaUnableRetryError $e) {
    var_dump($e->getMessage());
}

相關接口