Skip to content

Commit 7faba5c

Browse files
authored
Merge pull request #3213 from matrix-org/dbkr/fix_starting_with_video_muted
Fix bug where video would not unmute if it started muted
2 parents 1d9250b + 08054c1 commit 7faba5c

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

spec/unit/webrtc/call.spec.ts

+25
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,31 @@ describe("Call", function () {
431431
expect(transceivers.get("m.usermedia:video")!.sender.track!.id).toBe("usermedia_video_track");
432432
});
433433

434+
it("should unmute video after upgrading to video call", async () => {
435+
// Regression test for https://github.com/vector-im/element-call/issues/925
436+
await startVoiceCall(client, call);
437+
// start off with video muted
438+
await call.setLocalVideoMuted(true);
439+
440+
await call.onAnswerReceived(
441+
makeMockEvent("@test:foo", {
442+
version: 1,
443+
call_id: call.callId,
444+
party_id: "party_id",
445+
answer: {
446+
sdp: DUMMY_SDP,
447+
},
448+
[SDPStreamMetadataKey]: {},
449+
}),
450+
);
451+
452+
// then unmute which should cause an upgrade
453+
await call.setLocalVideoMuted(false);
454+
455+
// video should now be unmuted
456+
expect(call.isLocalVideoMuted()).toBe(false);
457+
});
458+
434459
it("should handle SDPStreamMetadata changes", async () => {
435460
await startVoiceCall(client, call);
436461

src/webrtc/call.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
14001400
}
14011401

14021402
if (!this.hasUserMediaVideoSender && !muted) {
1403+
this.localUsermediaFeed?.setAudioVideoMuted(null, muted);
14031404
await this.upgradeCall(false, true);
14041405
return this.isLocalVideoMuted();
14051406
}

0 commit comments

Comments
 (0)