Skip to content

Commit

Permalink
fix: retry audio track on unmute
Browse files Browse the repository at this point in the history
  • Loading branch information
raviteja83 authored Feb 11, 2025
1 parent db2ddcb commit 05782ef
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,10 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
}
}

async setEnabled(value: boolean) {
if (value === this.enabled) {
async setEnabled(value: boolean, skipcheck = false) {
if (value === this.enabled && !skipcheck) {
return;
}

// Replace silent empty track or muted track(happens when microphone is disabled from address bar in iOS) with an actual audio track, if enabled or ended track or when silence is detected.
if (value && this.shouldReacquireTrack()) {
await this.replaceTrackWith(this.settings);
Expand Down Expand Up @@ -348,7 +347,7 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
}),
);
try {
await this.setEnabled(this.enabled);
await this.setEnabled(this.enabled, true);
// whatsapp call doesn't seem to send video unmute natively, so use audio unmute to play video
this.eventBus.localAudioUnmutedNatively.publish();
} catch (error) {
Expand Down

0 comments on commit 05782ef

Please sign in to comment.