From e38c59c535856c48f8393e2c05b62208089a43a3 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Mon, 28 Nov 2022 12:43:59 +0100 Subject: [PATCH] Pause voice broadcast on calls (#9623) --- src/stores/widgets/StopGapWidget.ts | 4 ++-- src/voice-broadcast/models/VoiceBroadcastRecording.ts | 4 ++-- test/stores/widgets/StopGapWidget-test.ts | 6 +++--- test/voice-broadcast/models/VoiceBroadcastRecording-test.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index 59653bf384..70c359f1f3 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -283,8 +283,8 @@ export class StopGapWidget extends EventEmitter { this.messaging.on("capabilitiesNotified", () => this.emit("capabilitiesNotified")); this.messaging.on(`action:${WidgetApiFromWidgetAction.OpenModalWidget}`, this.onOpenModal); this.messaging.on(`action:${ElementWidgetActions.JoinCall}`, () => { - // stop voice broadcast recording when any widget sends a "join" - VoiceBroadcastRecordingsStore.instance().getCurrent()?.stop(); + // pause voice broadcast recording when any widget sends a "join" + VoiceBroadcastRecordingsStore.instance().getCurrent()?.pause(); }); // Always attach a handler for ViewRoom, but permission check it internally diff --git a/src/voice-broadcast/models/VoiceBroadcastRecording.ts b/src/voice-broadcast/models/VoiceBroadcastRecording.ts index e080c87224..bd5d2e5c0d 100644 --- a/src/voice-broadcast/models/VoiceBroadcastRecording.ts +++ b/src/voice-broadcast/models/VoiceBroadcastRecording.ts @@ -222,8 +222,8 @@ export class VoiceBroadcastRecording private onAction = (payload: ActionPayload) => { if (payload.action !== "call_state") return; - // stop on any call action - this.stop(); + // pause on any call action + this.pause(); }; private setState(state: VoiceBroadcastInfoState): void { diff --git a/test/stores/widgets/StopGapWidget-test.ts b/test/stores/widgets/StopGapWidget-test.ts index 133f830f3d..717fcc77f1 100644 --- a/test/stores/widgets/StopGapWidget-test.ts +++ b/test/stores/widgets/StopGapWidget-test.ts @@ -89,7 +89,7 @@ describe("StopGapWidget", () => { content: {}, }); voiceBroadcastRecording = new VoiceBroadcastRecording(voiceBroadcastInfoEvent, client); - jest.spyOn(voiceBroadcastRecording, "stop"); + jest.spyOn(voiceBroadcastRecording, "pause"); jest.spyOn(VoiceBroadcastRecordingsStore.instance(), "getCurrent").mockReturnValue(voiceBroadcastRecording); }); @@ -105,8 +105,8 @@ describe("StopGapWidget", () => { ); }); - it("should stop the current voice broadcast recording", () => { - expect(voiceBroadcastRecording.stop).toHaveBeenCalled(); + it("should pause the current voice broadcast recording", () => { + expect(voiceBroadcastRecording.pause).toHaveBeenCalled(); }); }); }); diff --git a/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts b/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts index f29dce46c3..a9df1d70ed 100644 --- a/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts +++ b/test/voice-broadcast/models/VoiceBroadcastRecording-test.ts @@ -296,7 +296,7 @@ describe("VoiceBroadcastRecording", () => { }, true); }); - itShouldBeInState(VoiceBroadcastInfoState.Stopped); + itShouldBeInState(VoiceBroadcastInfoState.Paused); }); describe("and a chunk time update occurs", () => {