最近更新时间:2022.04.08 18:59:59
首次发布时间:2022.04.08 18:59:59
使用前请前完成初始化,参考 初始化。
接口请求参数和返回参数详见 OpenAPI:提交媒体处理任务。
<?php require('../../../vendor/autoload.php'); use Volc\Service\Imp\Models\Request\ImpSubmitJobRequest; use Volc\Service\Imp\Models\Response\ImpSubmitJobResponse; use Volc\Service\Imp\Models\Business\InputPath; use Volc\Service\Imp\Imp; // call below method if you don't set ak and sk in $HOME/.vcloud/config $client = Imp::getInstance(); $client->setAccessKey("your ak"); $client->setSecretKey("your sk"); $request = new ImpSubmitJobRequest(); $inputPath = new InputPath(); $inputPath->setType("VOD"); $inputPath->setVodSpaceName("your space name"); $inputPath->setFileId("your file id"); $request->setTemplateId("your template id"); $request->setCallbackArgs("your callback args"); $request->setEnableLowPriority("false"); // true 开启 false 不开启 闲时转码 $request->setInputPath($inputPath); $response = new ImpSubmitJobResponse(); try { $response = $client->SubmitJob($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response->getResponseMetadata()->getError() != null) { print_r($response->getResponseMetadata()->getError()); } echo $response->serializeToJsonString(); echo "\n";
接口请求参数和返回参数详见 OpenAPI:查询媒体处理任务。
<?php require('../../../vendor/autoload.php'); use Volc\Service\Imp\Models\Request\ImpRetrieveJobRequest; use Volc\Service\Imp\Models\Response\ImpRetrieveJobResponse; use Volc\Service\Imp\Imp; // call below method if you don't set ak and sk in $HOME/.vcloud/config $client = Imp::getInstance(); $client->setAccessKey("your ak"); $client->setSecretKey("your sk"); $request = new ImpRetrieveJobRequest(); $jobIds = ["your job id 1", "your job id 2"]; $request->setJobIds($jobIds); $response = new ImpRetrieveJobResponse(); try { $response = $client->RetrieveJob($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response->getResponseMetadata()->getError() != null) { print_r($response->getResponseMetadata()->getError()); } echo $response->serializeToJsonString(); echo "\n";
接口请求参数和返回参数详见 OpenAPI:取消媒体处理任务。
<?php require('../../../vendor/autoload.php'); use Volc\Service\Imp\Models\Request\ImpKillJobRequest; use Volc\Service\Imp\Models\Response\ImpKillJobResponse; use Volc\Service\Imp\Imp; // call below method if you don't set ak and sk in $HOME/.vcloud/config $client = Imp::getInstance(); $client->setAccessKey("your ak"); $client->setSecretKey("your sk"); $request = new ImpKillJobRequest(); $request->setJobId("your job id"); $response = new ImpKillJobResponse(); try { $response = $client->KillJob($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response->getResponseMetadata()->getError() != null) { print_r($response->getResponseMetadata()->getError()); } echo $response->serializeToJsonString(); echo "\n";