0

I am importing & using microsoft-cognitiveservices-speech-sdkin VueJS Project but whenever I click on mic, I am getting below issue. enter image description here

This is what I tried:

import * as SDK from "microsoft-cognitiveservices-speech-sdk";
import { RecognitionResult } from "microsoft-cognitiveservices-speech-sdk";

 const speechConfig = SDK.SpeechConfig.fromSubscription(
      this.subscriptionKey,
      this.serviceRegion
    );
    speechConfig.speechRecognitionLanguage = "en-US";
    const audioConfig = SDK.AudioConfig.fromDefaultMicrophoneInput();
    const recognizer = await new SDK.SpeechRecognizer(speechConfig, audioConfig);
    if (recognizer) {
      this.isMicClicked = !this.isMicClicked;
      recognizer.recognizeOnceAsync((result: RecognitionResult) => {
        console.log(result);
        this.setCapturedText(result.text);
        this.isMicClicked = false;
        recognizer.close();
      }, (e: string) => {
        console.log(e);
        recognizer.close();
        this.isMicClicked = false;
      });
    }
Sonali
  • 37
  • 1
  • 9
  • using typescript & html would be there for UI – Sonali Mar 23 '23 at 07:47
  • One solution to this issue is to explicitly add the worker-src directive to your CSP and specify the sources from which workers are allowed to be created. https://stackoverflow.com/questions/54695310/getting-refused-to-create-worker-from-blob-error-in-video-min-js-when-looking – Ram Mar 27 '23 at 08:22

0 Answers0