SpeechToText-WebSockets-Javascript icon indicating copy to clipboard operation
SpeechToText-WebSockets-Javascript copied to clipboard

Using navigator in node app

Open Sipsip opened this issue 7 years ago • 1 comments

As suggested, i used the code for node apps:

function RecognizerSetup(SDK, recognitionMode, language, format, subscriptionKey) {
    let recognizerConfig = new SDK.RecognizerConfig(
        new SDK.SpeechConfig(
            new SDK.Context(
                new SDK.OS(navigator.userAgent, "Browser", null),
                new SDK.Device("SpeechSample", "SpeechSample", "1.0.00000"))),
        recognitionMode, // SDK.RecognitionMode.Interactive  (Options - Interactive/Conversation/Dictation)
        language, // Supported languages are specific to each recognition mode Refer to docs.
        format); // SDK.SpeechResultFormat.Simple (Options - Simple/Detailed)

    // Alternatively use SDK.CognitiveTokenAuthentication(fetchCallback, fetchOnExpiryCallback) for token auth
    let authentication = new SDK.CognitiveSubscriptionKeyAuthentication(subscriptionKey);

    return SDK.Recognizer.Create(recognizerConfig, authentication);
}

But node does not now any navigator, so what can I use for new SDK.OS(), to set the environment?

Sipsip avatar May 25 '18 07:05 Sipsip

Node.js does not come with audio source and WebRTC. You will have to bring in a custom audio source by implementing IAudioSource and create a recognizer with it.

compulim avatar Jun 30 '18 22:06 compulim