Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestions: create audio worklet blob URL only if audioContext.audioWorklet is supported #572

Closed
compulim opened this issue Sep 28, 2022 · 1 comment · Fixed by #574
Closed
Assignees

Comments

@compulim
Copy link
Contributor

In PCMRecorder.ts, no matter if audioContext.audioWorklet is supported by the browser/environment, it will create audio worklet as blob URL.

I think the better logic should be:

if (!!context.audioWorklet) {
  if (!this.privSpeechProcessorScript) {
    ...
   this.privSpeechProcessorScript = URL.createObjectURL(blob);
  }

  context.audioWorklet
    .addModule(this.privSpeechProcessorScript)

  ...
}

This will help when the SDK is run under JSDOM, such as Jest. This is because JSDOM does not support URL.createObjectURL.

@glharper
Copy link
Member

@compulim Thanks for writing this up, and using JS Speech SDK. If you create a PR, I'll test the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants