Skip to content

Commit 7bf1944

Browse files
Fix order of muteStateChange update
1 parent fe3a453 commit 7bf1944

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ts/services/calling.preload.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,6 @@ export class CallingClass {
622622
});
623623
log.info(logId);
624624

625-
muteStateChange.setIsMuted(!hasLocalAudio);
626-
627625
const callMode = getConversationCallMode(conversation);
628626
switch (callMode) {
629627
case null:
@@ -679,6 +677,7 @@ export class CallingClass {
679677

680678
log.info(`${logId}: Starting lobby`);
681679
await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo });
680+
muteStateChange.setIsMuted(!hasLocalAudio);
682681

683682
// It's important that this function comes before any calls to
684683
// `videoCapturer.enableCapture` or `videoCapturer.enableCaptureAndSend` because of
@@ -1035,7 +1034,6 @@ export class CallingClass {
10351034
const logId = `startCallLinkLobby(roomId=${roomId})`;
10361035
log.info(`${logId}: starting`);
10371036

1038-
muteStateChange.setIsMuted(!hasLocalAudio);
10391037
const hasLocalVideo = preferLocalVideo && (await checkCameraPermission());
10401038

10411039
const haveMediaPermissions = await this.#requestPermissions(hasLocalVideo);
@@ -1046,8 +1044,8 @@ export class CallingClass {
10461044
}
10471045

10481046
await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo });
1049-
10501047
await this.#startDeviceReselectionTimer();
1048+
muteStateChange.setIsMuted(!hasLocalAudio);
10511049

10521050
const authCredentialPresentation =
10531051
await getCallLinkAuthCredentialPresentation(callLinkRootKey);
@@ -1095,8 +1093,6 @@ export class CallingClass {
10951093
const logId = getLogId({ source: 'startOutgoingDirectCall', conversation });
10961094
log.info(logId);
10971095

1098-
muteStateChange.setIsMuted(!hasLocalAudio);
1099-
11001096
if (!this.#reduxInterface) {
11011097
throw new Error(`${logId}: Redux actions not available`);
11021098
}
@@ -1126,6 +1122,8 @@ export class CallingClass {
11261122
return;
11271123
}
11281124

1125+
muteStateChange.setIsMuted(!hasLocalAudio);
1126+
11291127
log.info(`${logId}: Getting call settings`);
11301128
// Check state after awaiting to debounce call button.
11311129
if (RingRTC.call && RingRTC.call.state !== CallState.Ended) {
@@ -1493,6 +1491,7 @@ export class CallingClass {
14931491

14941492
await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo });
14951493
await this.#startDeviceReselectionTimer();
1494+
muteStateChange.setIsMuted(!hasLocalAudio);
14961495

14971496
const groupCall = this.connectGroupCall(conversationId, {
14981497
groupId,
@@ -1853,6 +1852,7 @@ export class CallingClass {
18531852

18541853
await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo });
18551854
await this.#startDeviceReselectionTimer();
1855+
muteStateChange.setIsMuted(!hasLocalAudio);
18561856

18571857
const callLinkRootKey = CallLinkRootKey.parse(rootKey);
18581858
const callLinkEpoch = epoch ? CallLinkEpoch.parse(epoch) : undefined;
@@ -2227,6 +2227,7 @@ export class CallingClass {
22272227
hasLocalVideo: asVideoCall,
22282228
});
22292229
await this.#startDeviceReselectionTimer();
2230+
muteStateChange.setIsMuted(false);
22302231

22312232
if (asVideoCall) {
22322233
// Warm up the camera as soon as possible.

0 commit comments

Comments
 (0)