本文为您提供了服务端 Java SDK 的媒资管理模块的接口调用示例。
接口请求参数和返回参数说明详见获取媒资信息。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodGetMediaInfos20230701Demo { public static void main(String[] args) throws Exception { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); try { com.volcengine.service.vod.model.request.VodGetMediaInfosRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodGetMediaInfosRequest.newBuilder(); reqBuilder.setVids("your Vids"); com.volcengine.service.vod.model.response.VodGetMediaInfosResponse resp = vodService.getMediaInfos20230701(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见更新媒资信息。
package com.volcengine.example.vod.media; import com.google.protobuf.Int64Value; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.google.protobuf.StringValue; import com.volcengine.service.vod.model.request.VodUpdateMediaInfoRequest; import com.volcengine.service.vod.model.response.VodUpdateMediaInfoResponse; func Test_UpdateMediaInfo(t *testing.T) { // Create a VOD instance in the specified region. // instance := vod.NewInstanceWithRegion("cn-north-1") instance := vod.NewInstance() // 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/65655. // 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. // instance.SetCredential(base.Credentials{ // AccessKeyID: "your ak", // SecretAccessKey: "your sk", //}) query := &request.VodUpdateMediaInfoRequest{ Vid: "your Vid", PosterUri: nil, Title: nil, Description: nil, Tags: nil, ClassificationId: nil, ExpireTime: nil, } resp, status, err := instance.UpdateMediaInfo(query) fmt.Println(status) fmt.Println(err) fmt.Println(resp.String()) }
接口请求参数和返回参数说明详见修改媒资发布状态。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodUpdateMediaPublishStatusRequest; import com.volcengine.service.vod.model.response.VodUpdateMediaPublishStatusResponse; public class UpdateMediaPublishStatusDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String vid1 = "vid1"; String vid2 = "vid2"; String statusPublished = "Published"; String statusUnpublished = "Unpublished"; try { // publish VodUpdateMediaPublishStatusRequest.Builder req = VodUpdateMediaPublishStatusRequest.newBuilder(); req.setVid(vid1); req.setStatus(statusPublished); VodUpdateMediaPublishStatusResponse resp = vodService.updateMediaPublishStatus(req.build()); System.out.println(resp); Thread.sleep(1000); // unpublish VodUpdateMediaPublishStatusRequest.Builder req1 = VodUpdateMediaPublishStatusRequest.newBuilder(); req1.setVid(vid2); req1.setStatus(statusUnpublished); VodUpdateMediaPublishStatusResponse resp1 = vodService.updateMediaPublishStatus(req1.build()); System.out.println(resp1); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见修改媒资存储类型。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodUpdateMediaStorageClassDemo { public static void main(String[] args) throws Exception { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); try { com.volcengine.service.vod.model.request.VodUpdateMediaStorageClassRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodUpdateMediaStorageClassRequest.newBuilder(); reqBuilder.setVids("your Vids"); reqBuilder.setStorageClass("your StorageClass"); reqBuilder.setCallbackArgs("your CallbackArgs"); reqBuilder.setFileIds("your FileIds"); com.volcengine.service.vod.model.response.VodUpdateMediaStorageClassResponse resp = vodService.updateMediaStorageClass(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见获取封面候选结果。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodGetRecommendedPosterRequest; import com.volcengine.service.vod.model.response.VodGetRecommendedPosterResponse; public class GetRecommendedPosterDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String vids = "vid1,vid2,vid3"; try { VodGetRecommendedPosterRequest.Builder req = VodGetRecommendedPosterRequest.newBuilder(); req.setVids(vids); VodGetRecommendedPosterResponse resp = vodService.getRecommendedPoster(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见删除完整媒资。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodDeleteMediaRequest; import com.volcengine.service.vod.model.response.VodDeleteMediaResponse; public class DeleteMediaDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String vids = "vid1,vid2,vid3"; String callBackArgs = "CallBackArgs"; try { VodDeleteMediaRequest.Builder req = VodDeleteMediaRequest.newBuilder(); req.setVids(vids); req.setCallbackArgs(callBackArgs); VodDeleteMediaResponse resp = vodService.deleteMedia(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见删除媒体处理输出文件。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodDeleteTranscodesRequest; import com.volcengine.service.vod.model.response.VodDeleteTranscodesResponse; public class DeleteTranscodesDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String vid = "vid"; String fileIds = "fileId1,fileId2"; String callBackArgs = "CallBackArgs"; try { VodDeleteTranscodesRequest.Builder req = VodDeleteTranscodesRequest.newBuilder(); req.setVid(vid); req.setFileIds(fileIds); req.setCallbackArgs(callBackArgs); VodDeleteTranscodesResponse resp = vodService.deleteTranscodes(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见删除素材文件。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodDeleteMaterialDemo { public static void main(String[] args) throws Exception { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); try { com.volcengine.service.vod.model.request.VodDeleteMaterialRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodDeleteMaterialRequest.newBuilder(); reqBuilder.setMid("your Mid"); reqBuilder.setSpaceName("your SpaceName"); com.volcengine.service.vod.model.response.VodDeleteMaterialResponse resp = vodService.deleteMaterial(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见获取音视频信息。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodGetMediaListDemo { public static void main(String[] args) throws Exception { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); try { com.volcengine.service.vod.model.request.VodGetMediaListRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodGetMediaListRequest.newBuilder(); reqBuilder.setSpaceName("your SpaceName"); reqBuilder.setVid("your Vid"); reqBuilder.setStatus("your Status"); reqBuilder.setOrder("your Order"); reqBuilder.setTags("your Tags"); reqBuilder.setStartTime("your StartTime"); reqBuilder.setEndTime("your EndTime"); reqBuilder.setOffset("your Offset"); reqBuilder.setPageSize("your PageSize"); reqBuilder.setClassificationIds("your ClassificationIds"); reqBuilder.setTosStorageClasses("your TosStorageClasses"); reqBuilder.setVodUploadSources("your VodUploadSources"); com.volcengine.service.vod.model.response.VodGetMediaListResponse resp = vodService.getMediaList(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见获取字幕文件。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodGetSubtitleInfoListRequest; import com.volcengine.service.vod.model.response.VodGetSubtitleInfoListResponse; public class GetSubtitleInfoListDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String vid = "vid"; String fileIds = "fid1,fid2"; String formats = "format1,format2"; String languages = "l1,l2"; String languageIds = "lId1,lId2"; String subtitleIds = "s1,s2"; String status = "Published,Unpublished"; String title = "title"; String tag = "tag"; String ssl = "ssl"; String offset = "offset"; String pageSize = "pageSize"; try { VodGetSubtitleInfoListRequest.Builder req = VodGetSubtitleInfoListRequest.newBuilder(); req.setVid(vid); req.setFileIds(fileIds); req.setFormats(formats); req.setLanguages(languages); req.setLanguageIds(languageIds); req.setSubtitleIds(subtitleIds); req.setStatus(status); req.setTitle(title); req.setTag(tag); req.setSsl(ssl); req.setOffset(offset); req.setPageSize(pageSize); VodGetSubtitleInfoListResponse resp = vodService.getSubtitleInfoList(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见修改字幕发布状态。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodUpdateSubtitleStatusRequest; import com.volcengine.service.vod.model.response.VodUpdateSubtitleStatusResponse; public class UpdateSubtitleStatusDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String vid = "vid"; String fileIds = "fileId1,fileId2"; String formats = "format1,format2"; String languages = "language1,language2"; String status = "status"; try { VodUpdateSubtitleStatusRequest.Builder req = VodUpdateSubtitleStatusRequest.newBuilder(); req.setVid(vid); req.setFileIds(fileIds); req.setFormats(formats); req.setLanguages(languages); req.setStatus(status); VodUpdateSubtitleStatusResponse resp = vodService.updateSubtitleStatus(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见更新字幕信息。
package com.volcengine.example.vod.media; import com.google.protobuf.StringValue; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodUpdateSubtitleInfoRequest; import com.volcengine.service.vod.model.response.VodUpdateSubtitleInfoResponse; public class UpdateSubtitleInfoDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String vid = "vid"; String fileId = "fileId"; String format = "format"; String language = "language"; String title = "title"; String tag = "tag"; try { VodUpdateSubtitleInfoRequest.Builder req = VodUpdateSubtitleInfoRequest.newBuilder(); req.setVid(vid); req.setFileId(fileId); req.setFormat(format); req.setLanguage(language); req.setTitle(StringValue.of(title)); req.setTag(StringValue.of(tag)); VodUpdateSubtitleInfoResponse resp = vodService.updateSubtitleInfo(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见获取截图结果。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodListSnapshotsRequest; import com.volcengine.service.vod.model.response.VodListSnapshotsResponse; public class ListSnapshotsDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String vid = "your vid"; try { VodListSnapshotsRequest.Builder req = VodListSnapshotsRequest.newBuilder(); VodListSnapshotsResponse resp = vodService.listSnapshots(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见创建视频分类。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodCreateVideoClassificationRequest; import com.volcengine.service.vod.model.response.VodCreateVideoClassificationResponse; public class CreateVideoClassificationDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String space = "your space"; int level = 1; long parentId = 0; String classification = "you classification"; try { VodCreateVideoClassificationRequest.Builder req = VodCreateVideoClassificationRequest.newBuilder(); req.setSpaceName(space); req.setLevel(level); req.setParentId(parentId); req.setClassification(classification); VodCreateVideoClassificationResponse resp = vodService.createVideoClassification(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见查询视频分类。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodCreateVideoClassificationRequest; import com.volcengine.service.vod.model.request.VodListVideoClassificationsRequest; import com.volcengine.service.vod.model.response.VodCreateVideoClassificationResponse; import com.volcengine.service.vod.model.response.VodListVideoClassificationsResponse; public class ListVideoClassificationsDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String space = "your space"; long classificationId = 0; try { VodListVideoClassificationsRequest.Builder req = VodListVideoClassificationsRequest.newBuilder(); req.setSpaceName(space); req.setClassificationId(classificationId); VodListVideoClassificationsResponse resp = vodService.listVideoClassifications(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见更新视频分类。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodUpdateVideoClassificationRequest; import com.volcengine.service.vod.model.response.VodUpdateVideoClassificationResponse; public class UpdateVideoClassificationDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String space = "your space"; long classificationId = 0; String classification = "you classification"; try { VodUpdateVideoClassificationRequest.Builder req = VodUpdateVideoClassificationRequest.newBuilder(); req.setSpaceName(space); req.setClassificationId(classificationId); req.setClassification(classification); VodUpdateVideoClassificationResponse resp = vodService.updateVideoClassification(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见删除视频分类。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; import com.volcengine.service.vod.model.request.VodDeleteVideoClassificationRequest; import com.volcengine.service.vod.model.response.VodDeleteVideoClassificationResponse; public class DeleteVideoClassificationDemo { public static void main(String[] args) { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); String space = "your space"; long classificationId = 0; try { VodDeleteVideoClassificationRequest.Builder req = VodDeleteVideoClassificationRequest.newBuilder(); req.setSpaceName(space); req.setClassificationId(classificationId); VodDeleteVideoClassificationResponse resp = vodService.deleteVideoClassification(req.build()); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见根据文件路径获取媒资信息。
package com.volcengine.example.vod.media; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodListFileMetaInfosByFileNamesDemo { public static void main(String[] args) throws Exception { // Create a VOD instance in the specified region. // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); IVodService vodService = VodServiceImpl.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/65641. // 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. // vodService.setAccessKey("your ak"); // vodService.setSecretKey("your sk"); try { com.volcengine.service.vod.model.request.VodListFileMetaInfosByFileNamesRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodListFileMetaInfosByFileNamesRequest.newBuilder(); reqBuilder.setSpaceName("your SpaceName"); reqBuilder.setFileNameEncodeds("your FileNameEncodeds"); reqBuilder.setBucketName("your BucketName"); com.volcengine.service.vod.model.response.VodListFileMetaInfosByFileNamesResponse resp = vodService.listFileMetaInfosByFileNames(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }