mirror of https://github.com/vector-im/riot-web
Stop broadcast playback when stopping the broadcast (#9795)
parent
c0e0078b6e
commit
2152f2ab8b
|
@ -388,6 +388,7 @@ export class VoiceBroadcastPlayback
|
||||||
|
|
||||||
public stop(): void {
|
public stop(): void {
|
||||||
this.setState(VoiceBroadcastPlaybackState.Stopped);
|
this.setState(VoiceBroadcastPlaybackState.Stopped);
|
||||||
|
this.getCurrentPlayback()?.stop();
|
||||||
this.currentlyPlaying = null;
|
this.currentlyPlaying = null;
|
||||||
this.setPosition(0);
|
this.setPosition(0);
|
||||||
}
|
}
|
||||||
|
@ -397,7 +398,6 @@ export class VoiceBroadcastPlayback
|
||||||
if (this.getState() === VoiceBroadcastPlaybackState.Stopped) return;
|
if (this.getState() === VoiceBroadcastPlaybackState.Stopped) return;
|
||||||
|
|
||||||
this.setState(VoiceBroadcastPlaybackState.Paused);
|
this.setState(VoiceBroadcastPlaybackState.Paused);
|
||||||
if (!this.currentlyPlaying) return;
|
|
||||||
this.getCurrentPlayback()?.pause();
|
this.getCurrentPlayback()?.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,6 +411,10 @@ describe("VoiceBroadcastPlayback", () => {
|
||||||
stopPlayback();
|
stopPlayback();
|
||||||
itShouldSetTheStateTo(VoiceBroadcastPlaybackState.Stopped);
|
itShouldSetTheStateTo(VoiceBroadcastPlaybackState.Stopped);
|
||||||
|
|
||||||
|
it("should stop the playback", () => {
|
||||||
|
expect(chunk1Playback.stop).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
describe("and skipping to somewhere in the middle of the first chunk", () => {
|
describe("and skipping to somewhere in the middle of the first chunk", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
mocked(chunk1Playback.play).mockClear();
|
mocked(chunk1Playback.play).mockClear();
|
||||||
|
|
Loading…
Reference in New Issue