/// <summary>
/// 腾讯云语音识别,先从NuGet程序包获取TencentCloud,支持.net4.5以上
/// </summary>
public static void TencentCloud()
{
try
{
Credential cred = new Credential
{
SecretId = "xxx",
SecretKey = "xxx"
};
ClientProfile clientProfile = new ClientProfile();
HttpProfile httpProfile = new HttpProfile();
httpProfile.Endpoint = ("aai.tencentcloudapi.com");
clientProfile.HttpProfile = httpProfile;
AaiClient client = new AaiClient(cred, "ap-shenzhen-fsi", clientProfile);
SentenceRecognitionRequest req = new SentenceRecognitionRequest();
string strParams = "{\"ProjectId\":0,\"SubServiceType\":2,\"EngSerViceType\":\"16k\",\"SourceType\":0,\"VoiceFormat\":\"mp3\",\"UsrAudioKey\":\"12345\",\"Url\":\"https%3A%2F%2Fyoujie.dadongnet.cn%2FUploadAduio%2F9fe446eba9fd4dbc9f986cdbd7501aef.wav\"}";
req = SentenceRecognitionRequest.FromJsonString<SentenceRecognitionRequest>(strParams);
SentenceRecognitionResponse resp = client.SentenceRecognition(req).
ConfigureAwait(false).GetAwaiter().GetResult();
Console.WriteLine(AbstractModel.ToJsonString(resp));
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
Console.Read();
}