diff --git a/packages/hms-video-store/src/audio-sink-manager/AudioSinkManager.ts b/packages/hms-video-store/src/audio-sink-manager/AudioSinkManager.ts index fcd4593071..2d45dc0431 100644 --- a/packages/hms-video-store/src/audio-sink-manager/AudioSinkManager.ts +++ b/packages/hms-video-store/src/audio-sink-manager/AudioSinkManager.ts @@ -5,6 +5,7 @@ import { ErrorFactory } from '../error/ErrorFactory'; import { HMSAction } from '../error/HMSAction'; import { EventBus } from '../events/EventBus'; import { HMSDeviceChangeEvent, HMSTrackUpdate, HMSUpdateListener } from '../interfaces'; +import { HMSAudioContextHandler } from '../internal'; import { HMSRemoteAudioTrack } from '../media/tracks'; import { HMSRemotePeer } from '../sdk/models/peer'; import { Store } from '../sdk/store'; @@ -74,6 +75,7 @@ export class AudioSinkManager { if (this.autoPausedTracks.size > 0) { await this.unpauseAudioTracks(); } + await HMSAudioContextHandler.resumeContext(); } init(elementId?: string) { diff --git a/packages/hms-video-store/src/sdk/index.ts b/packages/hms-video-store/src/sdk/index.ts index c74c5c2e8e..fb184ade5f 100644 --- a/packages/hms-video-store/src/sdk/index.ts +++ b/packages/hms-video-store/src/sdk/index.ts @@ -667,6 +667,10 @@ export class HMSSdk implements HMSInterface { this.sdkState.isJoinInProgress = false; await this.publish(config.settings, previewRole); await this.deviceManager.autoSelectAudioOutput(); + // Throw autoplay error even if audio context is suspended as it will be used in Audio Plugins which can lead to no audio + if (HMSAudioContextHandler.getAudioContext().state === 'suspended') { + this.listener?.onError(ErrorFactory.TracksErrors.AutoplayBlocked(HMSAction.JOIN)); + } } catch (error) { this.analyticsTimer.end(TimedEvent.JOIN); this.sdkState.isJoinInProgress = false;