1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-31 15:24:23 +03:00

Fix bug where video would not unmute if it started muted

Fixes https://github.com/vector-im/element-call/issues/925
This commit is contained in:
David Baker
2023-03-13 17:04:43 +00:00
parent 333872e878
commit 08054c1d6d
2 changed files with 26 additions and 0 deletions

View File

@ -431,6 +431,31 @@ describe("Call", function () {
expect(transceivers.get("m.usermedia:video")!.sender.track!.id).toBe("usermedia_video_track"); expect(transceivers.get("m.usermedia:video")!.sender.track!.id).toBe("usermedia_video_track");
}); });
it("should unmute video after upgrading to video call", async () => {
// Regression test for https://github.com/vector-im/element-call/issues/925
await startVoiceCall(client, call);
// start off with video muted
await call.setLocalVideoMuted(true);
await call.onAnswerReceived(
makeMockEvent("@test:foo", {
version: 1,
call_id: call.callId,
party_id: "party_id",
answer: {
sdp: DUMMY_SDP,
},
[SDPStreamMetadataKey]: {},
}),
);
// then unmute which should cause an upgrade
await call.setLocalVideoMuted(false);
// video should now be unmuted
expect(call.isLocalVideoMuted()).toBe(false);
});
it("should handle SDPStreamMetadata changes", async () => { it("should handle SDPStreamMetadata changes", async () => {
await startVoiceCall(client, call); await startVoiceCall(client, call);

View File

@ -1400,6 +1400,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
} }
if (!this.hasUserMediaVideoSender && !muted) { if (!this.hasUserMediaVideoSender && !muted) {
this.localUsermediaFeed?.setAudioVideoMuted(null, muted);
await this.upgradeCall(false, true); await this.upgradeCall(false, true);
return this.isLocalVideoMuted(); return this.isLocalVideoMuted();
} }