Handle broadcast chunk errors (#9970)

* Use strings for broadcast playback states

* Handle broadcast decode errors
This commit is contained in:
Michael Weimann 2023-01-24 11:20:26 +01:00 committed by GitHub
parent 60edb85a1a
commit 533b250bb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 483 additions and 275 deletions

View file

@ -186,7 +186,11 @@ describe("VoiceBroadcastPlayback", () => {
});
};
filterConsole("Starting load of AsyncWrapper for modal");
filterConsole(
"Starting load of AsyncWrapper for modal",
// expected for some tests
"Unable to load broadcast playback",
);
beforeEach(() => {
client = stubClient();
@ -283,6 +287,35 @@ describe("VoiceBroadcastPlayback", () => {
expect(playback.durationSeconds).toEqual(6.5);
});
describe("and starting a playback with a broken chunk", () => {
beforeEach(async () => {
mocked(chunk2Playback.prepare).mockRejectedValue("Error decoding chunk");
await playback.start();
});
itShouldSetTheStateTo(VoiceBroadcastPlaybackState.Error);
it("start() should keep it in the error state)", async () => {
await playback.start();
expect(playback.getState()).toBe(VoiceBroadcastPlaybackState.Error);
});
it("stop() should keep it in the error state)", () => {
playback.stop();
expect(playback.getState()).toBe(VoiceBroadcastPlaybackState.Error);
});
it("toggle() should keep it in the error state)", async () => {
await playback.toggle();
expect(playback.getState()).toBe(VoiceBroadcastPlaybackState.Error);
});
it("pause() should keep it in the error state)", () => {
playback.pause();
expect(playback.getState()).toBe(VoiceBroadcastPlaybackState.Error);
});
});
describe("and an event with the same transaction Id occurs", () => {
beforeEach(() => {
room.addLiveEvents([chunk2BEvent]);