Skip to content

Commit

Permalink
fix: toggle enabled state after unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
raviteja83 committed Feb 6, 2025
1 parent 74ca521 commit 4d6e023
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
}

private async replaceTrackWith(settings: HMSAudioTrackSettings) {
console.trace('replaceTrackWith', settings);
const prevTrack = this.nativeTrack;
/*
* Note: Do not change the order of this.
Expand Down Expand Up @@ -182,8 +183,8 @@ 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;
}

Expand Down Expand Up @@ -348,8 +349,7 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
}),
);
try {
await this.setEnabled(false);
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 4d6e023

Please sign in to comment.