Skip to content

Commit e204af0

Browse files
author
liyan.90210
committed
feat auto update sdk
1 parent 1f1f706 commit e204af0

27 files changed

+1731
-1115
lines changed

Changelog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Change log
22

3+
2025-03-27 Bumped to version v1.0.213
4+
- Updated apis for contentSecurity/vod
5+
36
2025-03-20 Bumped to version v1.0.212
47
- Updated apis for businessSecurity/vod
58

example/src/main/java/com/volcengine/example/vod/upload/VodUploadMaterialDemo.java

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.volcengine.service.vod.IVodService;
77
import com.volcengine.service.vod.impl.VodServiceImpl;
88
import com.volcengine.service.vod.model.request.VodUploadMaterialRequest;
9+
import com.volcengine.model.request.vod.VodStreamUploadRequest;
910
import com.volcengine.service.vod.model.response.VodCommitUploadInfoResponse;
1011

1112
import java.util.ArrayList;
@@ -59,6 +60,54 @@ public static void main(String[] args) {
5960
}
6061
}
6162

63+
// // 视频素材流上传
64+
// public static void main(String[] args) {
65+
// // Create a VOD instance in the specified region.
66+
// // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
67+
// IVodService vodService = VodServiceImpl.getInstance();
68+
//
69+
// // 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.
70+
// // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
71+
// // 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.
72+
// // vodService.setAccessKey("your ak");
73+
// // vodService.setSecretKey("your sk");
74+
//
75+
// String space = "your space name";
76+
//
77+
// List<Functions> functionsList = new ArrayList<>();
78+
// Functions getMetaFunc = Functions.GetMetaFunction();
79+
// functionsList.add(getMetaFunc);
80+
//
81+
// Functions snapShotFunc = Functions.SnapShotFunction(2.3);
82+
// functionsList.add(snapShotFunc);
83+
//
84+
// Functions addOptionInfo = Functions.AddOptionInfoFunction("素材测试视频", "test", "素材测试,视频文件", Const.CategoryVideo, "mp4");
85+
// functionsList.add(addOptionInfo);
86+
//
87+
// VodStreamUploadRequest vodUploadMaterialRequest = new VodStreamUploadRequest();
88+
// vodUploadMaterialRequest.setSpaceName(space);
89+
// vodUploadMaterialRequest.setFileType(Const.FileTypeMedia);
90+
// vodUploadMaterialRequest.setContent(null);
91+
// vodUploadMaterialRequest.setSize(0L);
92+
// vodUploadMaterialRequest.setChunkSize(0L);
93+
// vodUploadMaterialRequest.setFileName("hello/vod/material.mp4");
94+
// vodUploadMaterialRequest.setFunctions(JSON.toJSONString(functionsList));
95+
// vodUploadMaterialRequest.setStorageClass(0);
96+
//
97+
// try {
98+
// VodCommitUploadInfoResponse vodCommitUploadInfoResponse = vodService.streamUploadMaterial(vodUploadMaterialRequest);
99+
// if (vodCommitUploadInfoResponse.getResponseMetadata().hasError()) {
100+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getError());
101+
// System.exit(-1);
102+
// }
103+
// System.out.println(vodCommitUploadInfoResponse.toString());
104+
// System.out.println(vodCommitUploadInfoResponse.getResult().getData().getMid());
105+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getRequestId());
106+
// } catch (Exception e) {
107+
// e.printStackTrace();
108+
// }
109+
// }
110+
62111
//// 图片素材上传
63112
// public static void main(String[] args) {
64113
// // Create a VOD instance in the specified region.
@@ -106,6 +155,54 @@ public static void main(String[] args) {
106155
// }
107156
// }
108157

158+
// // 图片素材流上传
159+
// public static void main(String[] args) {
160+
// // Create a VOD instance in the specified region.
161+
// // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
162+
// IVodService vodService = VodServiceImpl.getInstance();
163+
//
164+
// // 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.
165+
// // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
166+
// // 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.
167+
// // vodService.setAccessKey("your ak");
168+
// // vodService.setSecretKey("your sk");
169+
//
170+
// String space = "your space name";
171+
//
172+
// List<Functions> functionsList = new ArrayList<>();
173+
// Functions getMetaFunc = Functions.GetMetaFunction();
174+
// functionsList.add(getMetaFunc);
175+
//
176+
// Functions snapShotFunc = Functions.SnapShotFunction(2.3);
177+
// functionsList.add(snapShotFunc);
178+
//
179+
// Functions addOptionInfo = Functions.AddOptionInfoFunction("素材测试图片", "test", "素材测试,图片文件", Const.CategoryImage, "jpg");
180+
// functionsList.add(addOptionInfo);
181+
//
182+
// VodStreamUploadRequest vodUploadMaterialRequest = new VodStreamUploadRequest();
183+
// vodUploadMaterialRequest.setSpaceName(space);
184+
// vodUploadMaterialRequest.setFileType(Const.FileTypeImage);
185+
// vodUploadMaterialRequest.setContent(null);
186+
// vodUploadMaterialRequest.setSize(0L);
187+
// vodUploadMaterialRequest.setChunkSize(0L);
188+
// vodUploadMaterialRequest.setFileName("hello/vod/material.jpeg");
189+
// vodUploadMaterialRequest.setFunctions(JSON.toJSONString(functionsList));
190+
// vodUploadMaterialRequest.setStorageClass(0);
191+
//
192+
// try {
193+
// VodCommitUploadInfoResponse vodCommitUploadInfoResponse = vodService.streamUploadMaterial(vodUploadMaterialRequest);
194+
// if (vodCommitUploadInfoResponse.getResponseMetadata().hasError()) {
195+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getError());
196+
// System.exit(-1);
197+
// }
198+
// System.out.println(vodCommitUploadInfoResponse.toString());
199+
// System.out.println(vodCommitUploadInfoResponse.getResult().getData().getMid());
200+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getRequestId());
201+
// } catch (Exception e) {
202+
// e.printStackTrace();
203+
// }
204+
// }
205+
109206
//// 字幕素材上传
110207
// public static void main(String[] args) {
111208
// // Create a VOD instance in the specified region.
@@ -153,4 +250,51 @@ public static void main(String[] args) {
153250
// }
154251
// }
155252

253+
// 字幕素材流上传
254+
// public static void main(String[] args) {
255+
// // Create a VOD instance in the specified region.
256+
// // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
257+
// IVodService vodService = VodServiceImpl.getInstance();
258+
//
259+
// // 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.
260+
// // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
261+
// // 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.
262+
// // vodService.setAccessKey("your ak");
263+
// // vodService.setSecretKey("your sk");
264+
//
265+
// String space = "your space name";
266+
//
267+
// List<Functions> functionsList = new ArrayList<>();
268+
// Functions getMetaFunc = Functions.GetMetaFunction();
269+
// functionsList.add(getMetaFunc);
270+
//
271+
// Functions snapShotFunc = Functions.SnapShotFunction(2.3);
272+
// functionsList.add(snapShotFunc);
273+
//
274+
// Functions addOptionInfo = Functions.AddOptionInfoFunction("素材测试字幕", "test", "素材测试,字幕文件", Const.CategorySubtitle, "vtt");
275+
// functionsList.add(addOptionInfo);
276+
//
277+
// VodStreamUploadRequest vodUploadMaterialRequest = new VodStreamUploadRequest();
278+
// vodUploadMaterialRequest.setSpaceName(space);
279+
// vodUploadMaterialRequest.setFileType(Const.FileTypeObject);
280+
// vodUploadMaterialRequest.setContent(null);
281+
// vodUploadMaterialRequest.setSize(0L);
282+
// vodUploadMaterialRequest.setChunkSize(0L);
283+
// vodUploadMaterialRequest.setFileName("hello/vod/material.vtt");
284+
// vodUploadMaterialRequest.setFunctions(JSON.toJSONString(functionsList));
285+
// vodUploadMaterialRequest.setStorageClass(0);
286+
//
287+
// try {
288+
// VodCommitUploadInfoResponse vodCommitUploadInfoResponse = vodService.streamUploadMaterial(vodUploadMaterialRequest);
289+
// if (vodCommitUploadInfoResponse.getResponseMetadata().hasError()) {
290+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getError());
291+
// System.exit(-1);
292+
// }
293+
// System.out.println(vodCommitUploadInfoResponse.toString());
294+
// System.out.println(vodCommitUploadInfoResponse.getResult().getData().getMid());
295+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getRequestId());
296+
// } catch (Exception e) {
297+
// e.printStackTrace();
298+
// }
299+
// }
156300
}

example/src/main/java/com/volcengine/example/vod/upload/VodUploadMediaDemo.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.volcengine.helper.VodUploadProgressListener;
66
import com.volcengine.model.beans.Functions;
77
import com.volcengine.model.beans.FunctionsWorkflowTemplate;
8+
import com.volcengine.model.request.vod.VodStreamUploadRequest;
89
import com.volcengine.service.vod.IVodService;
910
import com.volcengine.service.vod.impl.VodServiceImpl;
1011
import com.volcengine.service.vod.model.business.VodUploadTemplate;
@@ -81,4 +82,66 @@ public static void main(String[] args) {
8182
}
8283
}
8384

85+
//// 上传流
86+
// public static void main(String[] args) {
87+
// // Create a VOD instance in the specified region.
88+
// // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
89+
// IVodService vodService = VodServiceImpl.getInstance();
90+
//
91+
// // 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.
92+
// // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
93+
// // 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.
94+
// // vodService.setAccessKey("your ak");
95+
// // vodService.setSecretKey("your sk");
96+
//
97+
// String space = "your space name";
98+
//
99+
// List<Functions> functionsList = new ArrayList<>();
100+
// Functions getMetaFunc = Functions.GetMetaFunction();
101+
// functionsList.add(getMetaFunc);
102+
//
103+
// Functions snapShotFunc = Functions.SnapShotFunction(0);
104+
// functionsList.add(snapShotFunc);
105+
//
106+
// Functions addOptionInfo = Functions.AddOptionInfoFunction("hls测试视频", "test", "素材测试,视频文件", 0, true);
107+
// functionsList.add(addOptionInfo);
108+
//
109+
//
110+
// List<String> impTemplateIds = new ArrayList<>();
111+
// impTemplateIds.add("imp template id");
112+
// FunctionsWorkflowTemplate impTemplate = new FunctionsWorkflowTemplate(impTemplateIds, "imp");
113+
//
114+
// List<String> transcodeTemplateIds = new ArrayList<>();
115+
// transcodeTemplateIds.add("transcode template id");
116+
// FunctionsWorkflowTemplate transcodeTemplate = new FunctionsWorkflowTemplate(transcodeTemplateIds,
117+
// "transcode");
118+
//
119+
// List<FunctionsWorkflowTemplate> templates = new ArrayList<>();
120+
// templates.add(impTemplate);
121+
// templates.add(transcodeTemplate);
122+
// Functions workflowFunc = Functions.StartWorkFlowFunction(templates);
123+
// functionsList.add(workflowFunc);
124+
//
125+
// VodStreamUploadRequest vodStreamUploadRequest = new VodStreamUploadRequest();
126+
// vodStreamUploadRequest.setSpaceName(space);
127+
// vodStreamUploadRequest.setContent(null);
128+
// vodStreamUploadRequest.setSize(0L);
129+
// vodStreamUploadRequest.setChunkSize(0L);
130+
// vodStreamUploadRequest.setFileName("hello/vod/video.mp4");
131+
// vodStreamUploadRequest.setFunctions(JSON.toJSONString(functionsList));
132+
// vodStreamUploadRequest.setStorageClass(0);
133+
//
134+
// try {
135+
// VodCommitUploadInfoResponse vodCommitUploadInfoResponse = vodService.streamUploadMedia(vodStreamUploadRequest);
136+
// if (vodCommitUploadInfoResponse.getResponseMetadata().hasError()) {
137+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getError());
138+
// System.exit(-1);
139+
// }
140+
// System.out.println(vodCommitUploadInfoResponse.toString());
141+
// System.out.println(vodCommitUploadInfoResponse.getResult().getData().getVid());
142+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getRequestId());
143+
// } catch (Exception e) {
144+
// e.printStackTrace();
145+
// }
146+
// }
84147
}

example/src/main/java/com/volcengine/example/vod/upload/VodUploadObjectDemo.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.volcengine.service.vod.IVodService;
88
import com.volcengine.service.vod.impl.VodServiceImpl;
99
import com.volcengine.service.vod.model.request.VodUploadMediaRequest;
10+
import com.volcengine.model.request.vod.VodStreamUploadRequest;
1011
import com.volcengine.service.vod.model.response.VodCommitUploadInfoResponse;
1112

1213
import java.util.ArrayList;
@@ -55,4 +56,44 @@ public static void main(String[] args) {
5556
}
5657
}
5758

59+
// //Object流上传
60+
// public static void main(String[] args) {
61+
// // Create a VOD instance in the specified region.
62+
// // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
63+
// IVodService vodService = VodServiceImpl.getInstance();
64+
//
65+
// // 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.
66+
// // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
67+
// // 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.
68+
// // vodService.setAccessKey("your ak");
69+
// // vodService.setSecretKey("your sk");
70+
//
71+
// String space = "your space name";
72+
//
73+
// List<Functions> functionsList = new ArrayList<>();
74+
// Functions getMetaFunc = Functions.GetMetaFunction();
75+
// functionsList.add(getMetaFunc);
76+
//
77+
// VodStreamUploadRequest vodUploadObjectRequest = new VodStreamUploadRequest();
78+
// vodUploadObjectRequest.setSpaceName(space);
79+
// vodUploadObjectRequest.setContent(null);
80+
// vodUploadObjectRequest.setSize(0L);
81+
// vodUploadObjectRequest.setChunkSize(0L);
82+
// vodUploadObjectRequest.setFileName("hello/vod/1.ts");
83+
// vodUploadObjectRequest.setFunctions(JSON.toJSONString(functionsList));
84+
//
85+
// try {
86+
// VodCommitUploadInfoResponse vodCommitUploadInfoResponse = vodService.streamUploadObject(vodUploadObjectRequest);
87+
// if (vodCommitUploadInfoResponse.getResponseMetadata().hasError()) {
88+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getError());
89+
// System.exit(-1);
90+
// }
91+
// System.out.println(vodCommitUploadInfoResponse.toString());
92+
// System.out.println(vodCommitUploadInfoResponse.getResult().getData().getSourceInfo().getStoreUri());
93+
// System.out.println(vodCommitUploadInfoResponse.getResponseMetadata().getRequestId());
94+
// } catch (Exception e) {
95+
// e.printStackTrace();
96+
// }
97+
// }
98+
5899
}

volc-sdk-java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>com.volcengine</groupId>
7-
<version>1.0.212</version>
7+
<version>1.0.213</version>
88
<artifactId>volc-sdk-java</artifactId>
99

1010
<name>volc-sdk-java</name>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.volcengine.model.request.vod;
2+
3+
import com.alibaba.fastjson.annotation.JSONField;
4+
import lombok.Data;
5+
6+
import java.io.InputStream;
7+
import java.util.List;
8+
9+
@Data
10+
public class VodStreamUploadRequest {
11+
@JSONField(name = "SpaceName")
12+
String spaceName="";
13+
@JSONField(name = "Content")
14+
InputStream content;
15+
@JSONField(name = "FileType")
16+
String fileType="";
17+
@JSONField(name = "Size")
18+
Long Size=0L;
19+
@JSONField(name = "CallbackArgs")
20+
String callbackArgs="";
21+
@JSONField(name = "Functions")
22+
String functions="";
23+
@JSONField(name = "FileName")
24+
String fileName="";
25+
@JSONField(name = "StorageClass")
26+
Integer storageClass=0;
27+
@JSONField(name = "FileExtension")
28+
String fileExtension="";
29+
@JSONField(name = "VodUploadSource")
30+
String vodUploadSource="";
31+
@JSONField(name = "ClientNetWorkMode")
32+
String clientNetWorkMode="";
33+
@JSONField(name = "ClientIDCMode")
34+
String clientIDCMode="";
35+
@JSONField(name = "ExpireTime")
36+
String expireTime="";
37+
@JSONField(name = "UploadHostPrefer")
38+
String uploadHostPrefer="";
39+
@JSONField(name = "ChunkSize")
40+
Long chunkSize=0L;
41+
}

volc-sdk-java/src/main/java/com/volcengine/service/contentSecurity/impl/ContentSecurityServiceImpl.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import com.volcengine.service.contentSecurity.ContentSecurityService;
1212

1313
import java.util.ArrayList;
14+
import java.util.Map;
15+
import java.util.HashMap;
1416

1517
public class ContentSecurityServiceImpl extends BaseServiceImpl implements ContentSecurityService {
1618
private ContentSecurityServiceImpl() {
@@ -35,7 +37,11 @@ public ImageRiskDetectionResponse ImageRiskDetection(RiskDetectionRequest riskDe
3537

3638
@Override
3739
public ImageRiskDetectionResponse ImageRiskDetectionV2(RiskDetectionRequest riskDetectionRequest) throws Exception {
38-
RawResponse response = json(Const.ImageContentRiskV2, new ArrayList<>(), JSON.toJSONString(riskDetectionRequest));
40+
String aid = Integer.toString(riskDetectionRequest.getAppId());
41+
Map<String, String> aidMap = new HashMap<String, String>(){{
42+
put("aid", aid);
43+
}};
44+
RawResponse response = json(Const.ImageContentRiskV2, Utils.mapToPairList(aidMap), JSON.toJSONString(riskDetectionRequest));
3945
if (response.getCode() != SdkError.SUCCESS.getNumber()) {
4046
throw response.getException();
4147
}
@@ -216,7 +222,12 @@ public GetAudioLiveRiskResponse AudioLiveResult(ImageRiskResultRequest audioRisk
216222

217223
@Override
218224
public TextSliceRiskResponse TextSliceRisk(RiskDetectionRequest riskDetectionRequest) throws Exception {
219-
RawResponse response = json(Const.TextSliceRisk, new ArrayList<>(), JSON.toJSONString(riskDetectionRequest));
225+
String aid = Integer.toString(riskDetectionRequest.getAppId());
226+
Map<String, String> aidMap = new HashMap<String, String>(){{
227+
put("aid", aid);
228+
}};
229+
230+
RawResponse response = json(Const.TextSliceRisk, Utils.mapToPairList(aidMap), JSON.toJSONString(riskDetectionRequest));
220231
if (response.getCode() != SdkError.SUCCESS.getNumber()) {
221232
throw response.getException();
222233
}

0 commit comments

Comments
 (0)