Skip to content

Commit

Permalink
fix: missing awaits
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed Nov 19, 2024
1 parent 7fa8f2b commit 70ca28e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ 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';
Expand Down Expand Up @@ -73,7 +72,6 @@ export class AudioSinkManager {
*/
async unblockAutoplay() {
if (this.autoPausedTracks.size > 0) {
await HMSAudioContextHandler.resumeContext();
await this.unpauseAudioTracks();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class HMSAudioPluginsManager {
for (const plugin of plugins) {
await this.addPlugin(plugin);
}
this.updateProcessedTrack();
await this.updateProcessedTrack();
}

private async initAudioNodes() {
Expand Down
8 changes: 2 additions & 6 deletions packages/hms-video-store/src/utils/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ export async function getLocalDevices(): Promise<MediaDeviceGroups> {

export interface HMSAudioContext {
audioContext: AudioContext | null;
getAudioContext: () => AudioContext;
getAudioContext: (options?: AudioContextOptions) => AudioContext;
resumeContext: () => Promise<void>;
}

export const HMSAudioContextHandler: {
audioContext: AudioContext | null;
getAudioContext(options?: AudioContextOptions): AudioContext;
resumeContext(): Promise<void>;
} = {
export const HMSAudioContextHandler: HMSAudioContext = {
audioContext: null,
getAudioContext(options?: AudioContextOptions) {
const newAudioContextNeeded =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export function AutoplayBlockedModal() {
return (
<Dialog.Root
open={!!error}
onOpenChange={value => {
onOpenChange={async value => {
if (!value) {
unblockAudio();
await unblockAudio();
}
resetError();
}}
Expand All @@ -25,8 +25,8 @@ export function AutoplayBlockedModal() {
<DialogRow justify="end">
<Button
variant="primary"
onClick={() => {
unblockAudio();
onClick={async () => {
await unblockAudio();
resetError();
}}
>
Expand Down

0 comments on commit 70ca28e

Please sign in to comment.