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

Commit

Permalink
Do not resume voice broadcasts on seek (#9686)
Browse files Browse the repository at this point in the history
  • Loading branch information
weeman1337 authored Dec 5, 2022
1 parent 2d9fa81 commit f117548
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/voice-broadcast/models/VoiceBroadcastPlayback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export class VoiceBroadcastPlayback
const offsetInChunk = time - this.chunkEvents.getLengthTo(event);
await skipToPlayback.skipTo(offsetInChunk / 1000);

if (currentPlayback !== skipToPlayback) {
if (this.state === VoiceBroadcastPlaybackState.Playing && !skipToPlayback.isPlaying) {
await skipToPlayback.play();
}

Expand Down
11 changes: 11 additions & 0 deletions test/voice-broadcast/models/VoiceBroadcastPlayback-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,17 @@ describe("VoiceBroadcastPlayback", () => {
describe("and calling stop", () => {
stopPlayback();
itShouldSetTheStateTo(VoiceBroadcastPlaybackState.Stopped);

describe("and skipping to somewhere in the middle of the first chunk", () => {
beforeEach(async () => {
mocked(chunk1Playback.play).mockClear();
await playback.skipTo(1);
});

it("should not start the playback", () => {
expect(chunk1Playback.play).not.toHaveBeenCalled();
});
});
});

describe("and calling destroy", () => {
Expand Down

0 comments on commit f117548

Please sign in to comment.