From 28a295d4e1dcb55c2d2f11e7f8a1f8416ebbb4cf Mon Sep 17 00:00:00 2001 From: Josh Perez <60019601+josh-signal@users.noreply.github.com> Date: Thu, 26 Jan 2023 11:57:39 -0500 Subject: [PATCH] Fixes audio recording --- ts/WebAudioRecorder.ts | 2 -- ts/services/audioRecorder.ts | 6 +++--- ts/state/ducks/audioRecorder.ts | 1 + ts/window.d.ts | 2 -- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ts/WebAudioRecorder.ts b/ts/WebAudioRecorder.ts index 56cf902be..9bce3f198 100644 --- a/ts/WebAudioRecorder.ts +++ b/ts/WebAudioRecorder.ts @@ -157,5 +157,3 @@ export class WebAudioRecorder { this.onError(this, `WebAudioRecorder.js: ${message}`); } } - -window.WebAudioRecorder = WebAudioRecorder; diff --git a/ts/services/audioRecorder.ts b/ts/services/audioRecorder.ts index 8212fac5a..60a62b2aa 100644 --- a/ts/services/audioRecorder.ts +++ b/ts/services/audioRecorder.ts @@ -1,10 +1,10 @@ // Copyright 2016 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { requestMicrophonePermissions } from '../util/requestMicrophonePermissions'; import * as log from '../logging/log'; -import type { WebAudioRecorder } from '../WebAudioRecorder'; import * as Errors from '../types/errors'; +import { requestMicrophonePermissions } from '../util/requestMicrophonePermissions'; +import { WebAudioRecorder } from '../WebAudioRecorder'; export class RecorderClass { private context?: AudioContext; @@ -58,7 +58,7 @@ export class RecorderClass { this.context = new AudioContext(); this.input = this.context.createGain(); - this.recorder = new window.WebAudioRecorder( + this.recorder = new WebAudioRecorder( this.input, { timeLimit: 60 + 3600, // one minute more than our UI-imposed limit diff --git a/ts/state/ducks/audioRecorder.ts b/ts/state/ducks/audioRecorder.ts index 8939a5324..7adfb010d 100644 --- a/ts/state/ducks/audioRecorder.ts +++ b/ts/state/ducks/audioRecorder.ts @@ -116,6 +116,7 @@ function startRecording( }); } } catch (err) { + log.error('AudioRecorder/ERROR_RECORDING', err); dispatch({ type: ERROR_RECORDING, payload: ErrorDialogAudioRecorderType.ErrorRecording, diff --git a/ts/window.d.ts b/ts/window.d.ts index 41a29a593..f1750a613 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -55,7 +55,6 @@ import type { IPCEventsType } from './util/createIPCEvents'; import type { SignalContextType } from './windows/context'; import type * as Message2 from './types/Message2'; import type { initializeMigrations } from './signal'; -import type { WebAudioRecorder } from './WebAudioRecorder'; export { Long } from 'long'; @@ -205,7 +204,6 @@ declare global { MessageController: MessageController; SignalProtocolStore: typeof SignalProtocolStore; WebAPI: WebAPIConnectType; - WebAudioRecorder: typeof WebAudioRecorder; Whisper: WhisperType; getSignalProtocolStore: () => SignalProtocolStore; i18n: LocalizerType;