vod普通加密
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.peanut.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.tea.TeaException;
|
||||
import com.aliyun.teautil.models.RuntimeOptions;
|
||||
import com.aliyun.vod20170321.Client;
|
||||
@@ -150,6 +151,68 @@ public class SpdbUtil {
|
||||
}
|
||||
|
||||
|
||||
public static void startM3u8(String vid,String edk){
|
||||
com.aliyun.vod20170321.models.SubmitTranscodeJobsRequest submitTranscodeJobsRequest = new com.aliyun.vod20170321.models.SubmitTranscodeJobsRequest();
|
||||
submitTranscodeJobsRequest.setVideoId(vid);
|
||||
submitTranscodeJobsRequest.setTemplateGroupId("d346d2609a058b9dfd9b8bb392175721");
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("CipherText",edk);
|
||||
jsonObject.put("DecryptKeyUri","http://59.110.212.44:8099?CipherText="+edk);
|
||||
jsonObject.put("KeyServiceType","KMS");
|
||||
submitTranscodeJobsRequest.setEncryptConfig(jsonObject.toJSONString());
|
||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
try {
|
||||
// 复制代码运行请自行打印 API 的返回值
|
||||
client.submitTranscodeJobsWithOptions(submitTranscodeJobsRequest, runtime);
|
||||
} catch (TeaException error) {
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
} catch (Exception _error) {
|
||||
TeaException error = new TeaException(_error.getMessage(), _error);
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static GetPlayInfoResponseBody getUrl(String vid){
|
||||
com.aliyun.vod20170321.models.GetPlayInfoRequest getPlayInfoRequest = new com.aliyun.vod20170321.models.GetPlayInfoRequest();
|
||||
getPlayInfoRequest.setVideoId(vid);
|
||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
try {
|
||||
// 复制代码运行请自行打印 API 的返回值
|
||||
GetPlayInfoResponse playInfoWithOptions = client.getPlayInfoWithOptions(getPlayInfoRequest, runtime);
|
||||
GetPlayInfoResponseBody body = playInfoWithOptions.getBody();
|
||||
return body;
|
||||
} catch (TeaException error) {
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
return null;
|
||||
} catch (Exception _error) {
|
||||
TeaException error = new TeaException(_error.getMessage(), _error);
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static AssumeRoleResponse assumeRole() throws ClientException {
|
||||
|
||||
Reference in New Issue
Block a user