Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Catch 'Failed to construct AudioWorkletNode'
Browse files Browse the repository at this point in the history
  • Loading branch information
curtgrimes committed Jun 3, 2021
1 parent cbbe8e1 commit 4f776b9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/components/VolumeMeter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,16 @@ export default {
}
let microphone = audioContext.createMediaStreamSource(stream);
node = new AudioWorkletNode(audioContext, 'volume-meter');
try {
node = new AudioWorkletNode(audioContext, 'volume-meter');
} catch (e) {
if (e.name === 'InvalidStateError') {
// Sometimes users get this and I'm not sure why
// InvalidStateError: Failed to construct 'AudioWorkletNode': AudioWorkletNode cannot be created: The node name 'volume-meter' is not defined in AudioWorkletGlobalScope.
return;
}
}
node.port.onmessage = ({ data: volume }) => {
this.volume = volume;
Expand Down

0 comments on commit 4f776b9

Please sign in to comment.