You need to enable JavaScript to run this app.
导航
媒资管理
最近更新时间:2024.10.28 15:41:54首次发布时间:2021.02.23 10:42:39

本文为您提供了服务端 PHP SDK 的媒资管理模块的接口调用示例。

前提条件

调用接口前,请先完成 SDK 的安装初始化

调用示例

获取媒资信息

接口请求参数和返回参数详见获取媒资信息

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodGetMediaInfosRequest();
$request->setVids("your Vids");


$response = new Volc\Service\Vod\Models\Response\VodGetMediaInfosResponse();
try {
    $response = $client->getMediaInfos20230701($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

更新媒资信息

接口请求参数和返回参数详见 OpenAPI:更新媒资信息

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodUpdateMediaInfoRequest();
$request->setVid("your Vid");
$request->setPosterUriUnwrapped("your PosterUri");
$request->setTitleUnwrapped("your Title");
$request->setDescriptionUnwrapped("your Description");
$request->setTagsUnwrapped("your Tags");
$request->setClassificationIdUnwrapped(0);


$response = new Volc\Service\Vod\Models\Response\VodUpdateMediaInfoResponse();
try {
    $response = $client->updateMediaInfo($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

修改媒资发布状态

接口请求参数和返回参数详见OpenAPI:修改媒资发布状态

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodUpdateMediaPublishStatusRequest();
$request->setVid("your Vid");
$request->setStatus("your Status");


$response = new Volc\Service\Vod\Models\Response\VodUpdateMediaPublishStatusResponse();
try {
    $response = $client->updateMediaPublishStatus($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

修改媒资存储类型

接口请求参数和返回参数详见 OpenAPI:修改媒资存储类型

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodUpdateMediaStorageClassRequest();
$request->setVids("your Vids");
$request->setStorageClass("your StorageClass");
$request->setCallbackArgs("your CallbackArgs");
$request->setFileIds("your FileIds");

$response = new Volc\Service\Vod\Models\Response\VodUpdateMediaStorageClassResponse();
try {
    $response = $client->updateMediaStorageClass($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

获取封面候选结果

接口请求参数和返回参数详见 OpenAPI:获取封面候选结果

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodGetRecommendedPosterRequest();
$request->setVids("your Vids");


$response = new Volc\Service\Vod\Models\Response\VodGetRecommendedPosterResponse();
try {
    $response = $client->getRecommendedPoster($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

删除完整媒资

接口请求参数和返回参数详见 OpenAPI:删除完整媒资

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodDeleteMediaRequest();
$request->setVids("your Vids");
$request->setCallbackArgs("your CallbackArgs");


$response = new Volc\Service\Vod\Models\Response\VodDeleteMediaResponse();
try {
    $response = $client->deleteMedia($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

删除媒体处理输出文件

接口请求参数和返回参数详见 OpenAPI:删除媒体处理输出文件

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodDeleteTranscodesRequest();
$request->setVid("your Vid");
$request->setFileIds("your FileIds");
$request->setCallbackArgs("your CallbackArgs");


$response = new Volc\Service\Vod\Models\Response\VodDeleteTranscodesResponse();
try {
    $response = $client->deleteTranscodes($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

删除素材文件

接口请求参数和返回参数说明详见删除素材文件

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodDeleteMaterialRequest();
$request->setMid("your Mid");
$request->setSpaceName("your SpaceName");


$response = new Volc\Service\Vod\Models\Response\VodDeleteMaterialResponse();
try {
    $response = $client->deleteMaterial($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

获取音视频信息

接口请求参数和返回参数详见 OpenAPI:获取音视频信息

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodGetMediaListRequest();
$request->setSpaceName("your SpaceName");
$request->setVid("your Vid");
$request->setStatus("your Status");
$request->setOrder("your Order");
$request->setTags("your Tags");
$request->setStartTime("your StartTime");
$request->setEndTime("your EndTime");
$request->setOffset("your Offset");
$request->setPageSize("your PageSize");
$request->setClassificationIds("your ClassificationIds");
$request->setTosStorageClasses("your TosStorageClasses");
$request->setVodUploadSources("your VodUploadSources");


$response = new Volc\Service\Vod\Models\Response\VodGetMediaListResponse();
try {
    $response = $client->getMediaList($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

获取字幕文件

接口请求参数和返回参数详见 OpenAPI:获取字幕文件

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodGetSubtitleInfoListRequest();
$request->setVid("your Vid");
$request->setFileIds("your FileIds");
$request->setLanguages("your Languages");
$request->setFormats("your Formats");
$request->setLanguageIds("your LanguageIds");
$request->setSubtitleIds("your SubtitleIds");
$request->setStatus("your Status");
$request->setTitle("your Title");
$request->setTag("your Tag");
$request->setOffset("your Offset");
$request->setPageSize("your PageSize");
$request->setSsl("your Ssl");


$response = new Volc\Service\Vod\Models\Response\VodGetSubtitleInfoListResponse();
try {
    $response = $client->getSubtitleInfoList($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

修改字幕发布状态

接口请求参数和返回参数详见 OpenAPI:修改字幕发布状态

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodUpdateSubtitleStatusRequest();
$request->setVid("your Vid");
$request->setFileIds("your FileIds");
$request->setLanguages("your Languages");
$request->setFormats("your Formats");
$request->setStatus("your Status");


$response = new Volc\Service\Vod\Models\Response\VodUpdateSubtitleStatusResponse();
try {
    $response = $client->updateSubtitleStatus($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

修改字幕信息

接口请求参数和返回参数详见 OpenAPI:修改字幕信息

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodUpdateSubtitleInfoRequest();
$request->setVid("your Vid");
$request->setFileId("your FileId");
$request->setLanguage("your Language");
$request->setFormat("your Format");
$request->setTitleUnwrapped("your Title");
$request->setTagUnwrapped("your Tag");


$response = new Volc\Service\Vod\Models\Response\VodUpdateSubtitleInfoResponse();
try {
    $response = $client->updateSubtitleInfo($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

获取截图结果

接口请求参数和返回参数详见 OpenAPI:获取截图结果

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodListSnapshotsRequest();
$request->setVid("your Vid");


$response = new Volc\Service\Vod\Models\Response\VodListSnapshotsResponse();
try {
    $response = $client->listSnapshots($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

提交跨空间文件迁移任务

接口请求参数和返回参数详见 OpenAPI:提交跨空间文件迁移任务

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodSubmitMoveObjectTaskRequest();
$request->setSourceSpace("your SourceSpace");
$request->setSourceFileName("your SourceFileName");
$request->setTargetSpace("your TargetSpace");
$request->setTargetFileName("your TargetFileName");
$request->setSaveSourceObject(false);
$request->setForceOverwrite(false);


$response = new Volc\Service\Vod\Models\Response\VodSubmitMoveObjectTaskResponse();
try {
    $response = $client->submitMoveObjectTask($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

查询跨空间文件迁移任务状态

接口请求参数和返回参数详见 OpenAPI:查询跨空间文件迁移任务状态

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodQueryMoveObjectTaskInfoRequest();
$request->setTaskId("your TaskId");
$request->setSourceSpace("your SourceSpace");
$request->setTargetSpace("your TargetSpace");


$response = new Volc\Service\Vod\Models\Response\VodQueryMoveObjectTaskInfoResponse();
try {
    $response = $client->queryMoveObjectTaskInfo($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

媒资分类

创建视频分类

接口请求参数和返回参数详见 OpenAPI:创建视频分类

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodCreateVideoClassificationRequest();
$request->setSpaceName("your SpaceName");
$request->setLevel(0);
$request->setParentId(0);
$request->setClassification("your Classification");


$response = new Volc\Service\Vod\Models\Response\VodCreateVideoClassificationResponse();
try {
    $response = $client->createVideoClassification($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

查询视频分类

接口请求参数和返回参数详见 OpenAPI:查询视频分类

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodListVideoClassificationsRequest();
$request->setSpaceName("your SpaceName");
$request->setClassificationId(0);


$response = new Volc\Service\Vod\Models\Response\VodListVideoClassificationsResponse();
try {
    $response = $client->listVideoClassifications($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

更新视频分类

接口请求参数和返回参数详见 OpenAPI:更新视频分类

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodUpdateVideoClassificationRequest();
$request->setSpaceName("your SpaceName");
$request->setClassificationId(0);
$request->setClassification("your Classification");


$response = new Volc\Service\Vod\Models\Response\VodUpdateVideoClassificationResponse();
try {
    $response = $client->updateVideoClassification($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

删除视频分类

接口请求参数和返回参数详见 OpenAPI:删除视频分类

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodDeleteVideoClassificationRequest();
$request->setSpaceName("your SpaceName");
$request->setClassificationId(0);


$response = new Volc\Service\Vod\Models\Response\VodDeleteVideoClassificationResponse();
try {
    $response = $client->deleteVideoClassification($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

DirectUrl 模式

根据文件路径获取文件信息

接口请求参数和返回参数详见 OpenAPI:根据文件路径获取文件信息

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodGetFileInfosRequest();
$request->setSpaceName("your SpaceName");
$request->setEncodedFileNames("your EncodedFileNames");
$request->setBucketName("your BucketName");


$response = new Volc\Service\Vod\Models\Response\VodGetFileInfosResponse();
try {
    $response = $client->getFileInfos($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

根据文件路径获取媒资信息

接口请求参数和返回参数详见 OpenAPI:根据文件路径获取媒资信息

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodListFileMetaInfosByFileNamesRequest();
$request->setSpaceName("your SpaceName");
$request->setFileNameEncodeds("your FileNameEncodeds");
$request->setBucketName("your BucketName");


$response = new Volc\Service\Vod\Models\Response\VodListFileMetaInfosByFileNamesResponse();
try {
    $response = $client->listFileMetaInfosByFileNames($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

根据文件路径修改媒资存储类型

接口请求参数和返回参数详见 OpenAPI:根据文件路径修改媒资存储类型

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodUpdateFileStorageClassRequest();
$request->setSpaceName("your SpaceName");
$request->setBucketName("your BucketName");

$fileUpdateInfo = new Volc\Service\Vod\Models\Business\VodFileUpdateInfo();
$fileUpdateInfo->setFileName("your FileName");
$fileUpdateInfo->setStorageClass("your StorageClass");
$request->setFileUpdateInfos([$fileUpdateInfo]);

$response = new Volc\Service\Vod\Models\Response\VodUpdateFileStorageClassResponse();
try {
    $response = $client->updateFileStorageClass($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}

根据文件路径删除媒体文件

接口请求参数和返回参数详见 OpenAPI:根据文件路径删除媒体文件

<?php
require('../../vendor/autoload.php');

// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();

// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');

$request = new Volc\Service\Vod\Models\Request\VodDeleteMediaTosFileRequest();
$request->setFileNames(["your FileNames"]);
$request->setSpaceName("your SpaceName");


$response = new Volc\Service\Vod\Models\Response\VodDeleteMediaTosFileResponse();
try {
    $response = $client->deleteMediaTosFile($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
    echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
    echo $response->serializeToJsonString(), "\n";
}