|
@@ -17,13 +17,13 @@ import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
-//@Slf4j
|
|
|
|
|
|
+@Slf4j
|
|
public class CosUtil {
|
|
public class CosUtil {
|
|
public static final String secretId = "AKIDE6IpMi8fJQRCg1iuWzFajjRs43kbbets";
|
|
public static final String secretId = "AKIDE6IpMi8fJQRCg1iuWzFajjRs43kbbets";
|
|
public static final String secretKey = "tXzuwMfplTTK3c9GFUyETilasvQfePu9";
|
|
public static final String secretKey = "tXzuwMfplTTK3c9GFUyETilasvQfePu9";
|
|
public static final String region = "ap-chongqing";
|
|
public static final String region = "ap-chongqing";
|
|
- public static final String bucket = "part-1301855440";
|
|
|
|
- public static final String host = "https://media-1301855440.cos.ap-chongqing.myqcloud.com";
|
|
|
|
|
|
+ public static final String bucket = "media-1301855440";
|
|
|
|
+ public static final String host = "https://" + bucket +".cos.ap-chongqing.myqcloud.com";
|
|
|
|
|
|
|
|
|
|
//创建采样视频截图模板
|
|
//创建采样视频截图模板
|
|
@@ -46,9 +46,9 @@ public class CosUtil {
|
|
|
|
|
|
CreateSampleSnapshotTemplateResponse resp = client.CreateSampleSnapshotTemplate(req);
|
|
CreateSampleSnapshotTemplateResponse resp = client.CreateSampleSnapshotTemplate(req);
|
|
|
|
|
|
- System.out.println(CreateSampleSnapshotTemplateRequest.toJsonString(resp));
|
|
|
|
|
|
+ log.info(CreateSampleSnapshotTemplateRequest.toJsonString(resp));
|
|
} catch (TencentCloudSDKException e) {
|
|
} catch (TencentCloudSDKException e) {
|
|
- System.out.println(e.toString());
|
|
|
|
|
|
+ log.error(e.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -73,9 +73,9 @@ public class CosUtil {
|
|
|
|
|
|
DescribeSampleSnapshotTemplatesResponse resp = client.DescribeSampleSnapshotTemplates(req);
|
|
DescribeSampleSnapshotTemplatesResponse resp = client.DescribeSampleSnapshotTemplates(req);
|
|
|
|
|
|
- System.out.println(DescribeSampleSnapshotTemplatesRequest.toJsonString(resp));
|
|
|
|
|
|
+ log.info(DescribeSampleSnapshotTemplatesRequest.toJsonString(resp));
|
|
} catch (TencentCloudSDKException e) {
|
|
} catch (TencentCloudSDKException e) {
|
|
- System.out.println(e.toString());
|
|
|
|
|
|
+ log.error(e.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -97,10 +97,10 @@ public class CosUtil {
|
|
|
|
|
|
DescribeTaskDetailResponse resp = client.DescribeTaskDetail(req);
|
|
DescribeTaskDetailResponse resp = client.DescribeTaskDetail(req);
|
|
|
|
|
|
- System.out.println(DescribeTaskDetailRequest.toJsonString(resp));
|
|
|
|
|
|
+ log.info(DescribeTaskDetailRequest.toJsonString(resp));
|
|
return DescribeTaskDetailRequest.toJsonString(resp);
|
|
return DescribeTaskDetailRequest.toJsonString(resp);
|
|
} catch (TencentCloudSDKException e) {
|
|
} catch (TencentCloudSDKException e) {
|
|
- System.out.println(e.toString());
|
|
|
|
|
|
+ log.error(e.toString());
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -119,16 +119,16 @@ public class CosUtil {
|
|
|
|
|
|
MpsClient client = new MpsClient(cred, region, clientProfile);
|
|
MpsClient client = new MpsClient(cred, region, clientProfile);
|
|
|
|
|
|
- String params = "{\"InputInfo\":{\"Type\":\"COS\",\"CosInputInfo\":{\"Bucket\":\"" + bucket + "\",\"Region\":\"" + region + "\",\"Object\":\"" + videoPath + "\"}},\"MediaProcessTask\":{\"SampleSnapshotTaskSet\":[{\"Definition\":42095,\"OutputStorage\":{\"Type\":\"COS\",\"CosOutputStorage\":{\"Bucket\":\"part-1301855440\",\"Region\":\"" + region + "\"}},\"OutputObjectPath\":\"" + snapshotPath + "\"}]}}";
|
|
|
|
|
|
+ String params = "{\"InputInfo\":{\"Type\":\"COS\",\"CosInputInfo\":{\"Bucket\":\"" + bucket + "\",\"Region\":\"" + region + "\",\"Object\":\"" + videoPath + "\"}},\"MediaProcessTask\":{\"SampleSnapshotTaskSet\":[{\"Definition\":42095,\"OutputStorage\":{\"Type\":\"COS\",\"CosOutputStorage\":{\"Bucket\":\""+ bucket +"\",\"Region\":\"" + region + "\"}},\"OutputObjectPath\":\"" + snapshotPath + "\"}]}}";
|
|
|
|
|
|
ProcessMediaRequest req = ProcessMediaRequest.fromJsonString(params, ProcessMediaRequest.class);
|
|
ProcessMediaRequest req = ProcessMediaRequest.fromJsonString(params, ProcessMediaRequest.class);
|
|
|
|
|
|
ProcessMediaResponse resp = client.ProcessMedia(req);
|
|
ProcessMediaResponse resp = client.ProcessMedia(req);
|
|
|
|
|
|
- System.out.println(ProcessMediaRequest.toJsonString(resp));
|
|
|
|
|
|
+ log.info(ProcessMediaRequest.toJsonString(resp));
|
|
return ProcessMediaRequest.toJsonString(resp);
|
|
return ProcessMediaRequest.toJsonString(resp);
|
|
} catch (TencentCloudSDKException e) {
|
|
} catch (TencentCloudSDKException e) {
|
|
- System.out.println(e.toString());
|
|
|
|
|
|
+ log.error(e.toString());
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|