Pratik Ahire
Pratik Ahire

Reputation: 35

How to stop Microsoft cognitive-services-speech-sdk-js to stop listening manually?

I've implemented a Speech to Text conversion using Cognitive Services. I need it to stop listening after staying active for some specific time.

In C# version of the SDK, there is a method to make it stop listening as specified here. Sample - // Stops recognition. await recognizer.StopContinuousRecognitionAsync().ConfigureAwait(false);

I was looking similar method in JavaScript sdk but couldn't find any. So is there any way to make it stop listening?

EDIT - Adding my code sample-

var recognizer = new scope.SDK.SpeechRecognizer(speechConfig, audioConfig);
recognizer.recognizeOnceAsync(function (result) {
    console.log(result.text)
})

I need it to stop it even while it is listening to something.

Thanks.

Upvotes: 2

Views: 2542

Answers (1)

Related Questions