Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where video would not unmute if it started muted #3213

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions spec/unit/webrtc/call.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,31 @@ describe("Call", function () {
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 () => {
await startVoiceCall(client, call);

Expand Down
1 change: 1 addition & 0 deletions src/webrtc/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
}

if (!this.hasUserMediaVideoSender && !muted) {
this.localUsermediaFeed?.setAudioVideoMuted(null, muted);
await this.upgradeCall(false, true);
return this.isLocalVideoMuted();
}
Expand Down