My app: https://vcat.azurewebsites.net/voice
uses azure voice to text service on a blazor server side. It works fine locally, but when published at azure it does not work.
What is wrong?
As I have understood it is not only me who has this problem. This is another one: CognitiveServices.Speech Blazor Server not working when Published to Azure
here is the code:
private async Task record()
{
try
{
_isRecording = true;
_question = string.Empty;
_answer = string.Empty;
using var audioConfig = AudioConfig.FromDefaultMicrophoneInput();
using var speechRecognizer = new SpeechRecognizer(_speechConfig, audioConfig);
var speechRecognitionResult = await speechRecognizer.RecognizeOnceAsync();
_question = speechRecognitionResult.Text;
_isRecording = false;
if (string.IsNullOrEmpty(_question))
{
_question = "Please try again!";
}
else
{
//_isThinking = true;
await answer();
//_isThinking = false;
await speak();
}
}
catch (Exception ex)
{
Error?.ProcessError(ex);
}
}