
com.tencentcloudapi.ams.v20201229.AmsClient Maven / Gradle / Ivy
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencentcloudapi.ams.v20201229;
import java.lang.reflect.Type;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.AbstractClient;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.JsonResponseModel;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.ams.v20201229.models.*;
public class AmsClient extends AbstractClient{
private static String endpoint = "ams.tencentcloudapi.com";
private static String service = "ams";
private static String version = "2020-12-29";
public AmsClient(Credential credential, String region) {
this(credential, region, new ClientProfile());
}
public AmsClient(Credential credential, String region, ClientProfile profile) {
super(AmsClient.endpoint, AmsClient.version, credential, region, profile);
}
/**
*取消任务
* @param req CancelTaskRequest
* @return CancelTaskResponse
* @throws TencentCloudSDKException
*/
public CancelTaskResponse CancelTask(CancelTaskRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "CancelTask");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(Audio Moderation)用于提交音频内容(包括音频文件或流地址)进行智能审核任务,使用前请您登陆控制台开通音频内容安全服务。
### 功能使用说明:
- 前往“内容安全控制台-音频内容安全”开启使用音频内容安全服务,首次开通可获得20小时免费调用时长
### 接口功能说明:
- 支持对音频流或音频文件进行检测,判断其中是否包含违规内容;
- 支持设置回调地址 Callback 获取检测结果,或通过接口(查询音频检测结果)主动轮询获取检测结果;
- 支持识别违规内容,包括:低俗、谩骂、色情、涉政、广告等场景;
- 支持批量提交检测任务。检测任务列表最多支持10个;
### 音频文件调用说明:
- 音频文件大小支持:文件 < 500M;
- 音频文件时长支持:< 1小时;
- 音频码率类型支持:128 Kbps - 256 Kbps ;
- 音频文件支持格式:wav、mp3、aac、flac、amr、3gp、 m4a、wma、ogg、ape;
- 支持音视频文件分离并对音频文件进行独立识别;
### 音频流调用说明:
- 音频流时长支持:< 3小时;
- 音频码率类型支持:128 Kbps - 256 Kbps ;
- 音频流支持的传输协议:RTMP、HTTP、HTTPS;
- 音频流格式支持的类型:rtp、srtp、rtmp、rtmps、mmsh、 mmst、hls、http、tcp、https、m3u8;
- 支持音视频流分离并对音频流进行独立识别;
* @param req CreateAudioModerationTaskRequest
* @return CreateAudioModerationTaskResponse
* @throws TencentCloudSDKException
*/
public CreateAudioModerationTaskResponse CreateAudioModerationTask(CreateAudioModerationTaskRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "CreateAudioModerationTask");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*查看任务详情
* @param req DescribeTaskDetailRequest
* @return DescribeTaskDetailResponse
* @throws TencentCloudSDKException
*/
public DescribeTaskDetailResponse DescribeTaskDetail(DescribeTaskDetailRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeTaskDetail");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*查看审核任务列表
* @param req DescribeTasksRequest
* @return DescribeTasksResponse
* @throws TencentCloudSDKException
*/
public DescribeTasksResponse DescribeTasks(DescribeTasksRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeTasks");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy