如何在C#中通过Google.Cloud.Speech.V1使用apikey?

时间:2018-12-28 21:10:39

标签: c# google-cloud-platform speech api-key google-cloud-speech

如何在C#中通过Google.Cloud.Speech.V1使用apikey?

我有 Google.Cloud.Speech.V1 版本v1.0.1,VisualStudio 2017和env var GOOGLE_APPLICATION_CREDENTIALS 身份验证正常。但是我想使用ApiKeys并在后端自己管理用户。我已经在Google上搜索了很多天,却没有找到解决方案。

Google教程中的代码

https://cloud.google.com/speech-to-text/docs/quickstart-client-libraries

   var speech = SpeechClient.Create();
   var streamingCall = speech.StreamingRecognize();

   // Write the initial request with the config.
   await streamingCall.WriteAsync(
       new StreamingRecognizeRequest()
       {
           StreamingConfig = new StreamingRecognitionConfig()
           {
                Config = new RecognitionConfig()
                {
                    Encoding = RecognitionConfig.Types.AudioEncoding.Linear16,
                    SampleRateHertz = 16000,
                    LanguageCode = "en",
                },
                InterimResults = true,
            }
        });
    ...

谢谢您的任何建议!

0 个答案:

没有答案