rnnoise: fix error on webcam (#29)
errored because there was no audio stream, luckily the patched function had a boolean indicating if it was audio or not so just ignore it if it isnt Reviewed-on: https://codeberg.org/Ven/cord/pulls/29 Co-authored-by: Luna <imlvnaa@gmail.com> Co-committed-by: Luna <imlvnaa@gmail.com>
This commit is contained in:
		
							parent
							
								
									afa47addd7
								
							
						
					
					
						commit
						452bf72e56
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -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(); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue