Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 2152f2a

Browse files
authored
Stop broadcast playback when stopping the broadcast (#9795)
1 parent c0e0078 commit 2152f2a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/voice-broadcast/models/VoiceBroadcastPlayback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ export class VoiceBroadcastPlayback
388388

389389
public stop(): void {
390390
this.setState(VoiceBroadcastPlaybackState.Stopped);
391+
this.getCurrentPlayback()?.stop();
391392
this.currentlyPlaying = null;
392393
this.setPosition(0);
393394
}
@@ -397,7 +398,6 @@ export class VoiceBroadcastPlayback
397398
if (this.getState() === VoiceBroadcastPlaybackState.Stopped) return;
398399

399400
this.setState(VoiceBroadcastPlaybackState.Paused);
400-
if (!this.currentlyPlaying) return;
401401
this.getCurrentPlayback()?.pause();
402402
}
403403

test/voice-broadcast/models/VoiceBroadcastPlayback-test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ describe("VoiceBroadcastPlayback", () => {
411411
stopPlayback();
412412
itShouldSetTheStateTo(VoiceBroadcastPlaybackState.Stopped);
413413

414+
it("should stop the playback", () => {
415+
expect(chunk1Playback.stop).toHaveBeenCalled();
416+
});
417+
414418
describe("and skipping to somewhere in the middle of the first chunk", () => {
415419
beforeEach(async () => {
416420
mocked(chunk1Playback.play).mockClear();

0 commit comments

Comments
 (0)