Skip to content

Commit

Permalink
fix: handle audio permission if muted
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 committed Sep 16, 2024
1 parent 15631c4 commit 7dbd42d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,19 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {

private handleVisibilityChange = async () => {
// track state is fine do nothing
if (!this.isTrackNotPublishing()) {
console.log(this.isTrackNotPublishing(), this.enabled, this.nativeTrack.readyState, this.nativeTrack.muted);
if (!this.isTrackNotPublishing() && this.enabled) {
HMSLogger.d(this.TAG, `visibiltiy: ${document.visibilityState}`, `${this}`);
return;
}
if (document.visibilityState === 'hidden' && this.enabled) {
if (document.visibilityState === 'hidden') {
this.eventBus.analytics.publish(
this.sendInterruptionEvent({
started: true,
reason: 'visibility-change',
}),
);
} else if (this.enabled && document.visibilityState !== 'hidden') {
} else {
HMSLogger.d(this.TAG, 'On visibile replacing track as it is not publishing');
await this.replaceTrackWith(this.settings);
this.eventBus.analytics.publish(
Expand Down

0 comments on commit 7dbd42d

Please sign in to comment.