From 5f6df4995972ae276236dd52ef1f92c874960755 Mon Sep 17 00:00:00 2001 From: raviteja83 Date: Fri, 1 Mar 2024 19:49:09 +0530 Subject: [PATCH] fix: don't log polling device changes to analytics --- .../src/audio-sink-manager/AudioSinkManager.ts | 2 +- .../src/device-manager/DeviceManager.ts | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) 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 0d0d94377b..83bc2085f5 100644 --- a/packages/hms-video-store/src/audio-sink-manager/AudioSinkManager.ts +++ b/packages/hms-video-store/src/audio-sink-manager/AudioSinkManager.ts @@ -274,7 +274,7 @@ export class AudioSinkManager { } this.timer = setInterval(() => { (async () => { - await this.deviceManager.init(true); + await this.deviceManager.init(true, false); await this.autoSelectAudioOutput(); })(); }, 5000); diff --git a/packages/hms-video-store/src/device-manager/DeviceManager.ts b/packages/hms-video-store/src/device-manager/DeviceManager.ts index 2feb3481b5..d704335654 100644 --- a/packages/hms-video-store/src/device-manager/DeviceManager.ts +++ b/packages/hms-video-store/src/device-manager/DeviceManager.ts @@ -86,7 +86,7 @@ export class DeviceManager implements HMSDeviceManager { return newDevice; }; - async init(force = false) { + async init(force = false, logAnalytics = true) { if (this.initialized && !force) { return; } @@ -98,13 +98,15 @@ export class DeviceManager implements HMSDeviceManager { this.eventBus.deviceChange.publish({ devices: this.getDevices(), } as HMSDeviceChangeEvent); - this.eventBus.analytics.publish( - AnalyticsEventFactory.deviceChange({ - selection: this.getCurrentSelection(), - type: 'list', - devices: this.getDevices(), - }), - ); + if (logAnalytics) { + this.eventBus.analytics.publish( + AnalyticsEventFactory.deviceChange({ + selection: this.getCurrentSelection(), + type: 'list', + devices: this.getDevices(), + }), + ); + } } getDevices(): DeviceMap {