diff options
Diffstat (limited to 'src/plugins/rnnoise.web')
-rw-r--r-- | src/plugins/rnnoise.web/index.tsx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/rnnoise.web/index.tsx b/src/plugins/rnnoise.web/index.tsx index 7117ca2..8de6557 100644 --- a/src/plugins/rnnoise.web/index.tsx +++ b/src/plugins/rnnoise.web/index.tsx @@ -145,7 +145,7 @@ export default definePlugin({ find: "window.webkitAudioContext", replacement: { match: /(?<=\i\.acquire=function\((\i)\)\{return )navigator\.mediaDevices\.getUserMedia\(\1\)(?=\})/, - replace: m => `${m}.then(stream => $self.connectRnnoise(stream))` + replace: "$&.then(stream => $self.connectRnnoise(stream, $1.audio))" }, }, { @@ -182,7 +182,8 @@ export default definePlugin({ setEnabled, isEnabled: () => settings.store.isEnabled, - async connectRnnoise(stream: MediaStream): Promise<MediaStream> { + async connectRnnoise(stream: MediaStream, isAudio: boolean): Promise<MediaStream> { + if (!isAudio) return stream; if (!settings.store.isEnabled) return stream; const audioCtx = new AudioContext(); |