Skip to content

Commit

Permalink
fix: remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 committed Aug 1, 2024
1 parent 9d0f2c4 commit 13618a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ export class AudioSinkManager {
private listener?: HMSUpdateListener;
private timer: ReturnType<typeof setInterval> | null = null;
private autoUnpauseTimer: ReturnType<typeof setInterval> | null = null;
private earpieceSelected;
private earpieceSelected = false;

constructor(private store: Store, private deviceManager: DeviceManager, private eventBus: EventBus) {
console.log('called ');
this.eventBus.audioTrackAdded.subscribe(this.handleTrackAdd);
this.eventBus.audioTrackRemoved.subscribe(this.handleTrackRemove);
this.eventBus.audioTrackUpdate.subscribe(this.handleTrackUpdate);
this.eventBus.deviceChange.subscribe(this.handleAudioDeviceChange);
this.earpieceSelected = false;
this.startPollingForDevices();
this.startPollingToCheckPausedAudio();
}
Expand Down Expand Up @@ -299,13 +297,11 @@ export class AudioSinkManager {
}
const { bluetoothDevice, earpiece, speakerPhone, wired } = this.deviceManager.categorizeAudioInputDevices();
const localAudioTrack = this.store.getLocalPeer()?.audioTrack;
console.log('autoSelectAudioOutput> earpiece ', earpiece);
if (localAudioTrack && earpiece) {
const manualSelection = this.deviceManager.getManuallySelectedAudioDevice();
console.log('autoSelectAudioOutput> maunal selection ', manualSelection, this.earpieceSelected);
const externalDeviceID =
manualSelection?.deviceId || bluetoothDevice?.deviceId || wired?.deviceId || speakerPhone?.deviceId;
HMSLogger.d(this.TAG, 'externalDeviceID', externalDeviceID, localAudioTrack.settings.deviceId);
HMSLogger.d(this.TAG, 'externalDeviceID', externalDeviceID);
// already selected appropriate device
if (localAudioTrack.settings.deviceId === externalDeviceID && this.earpieceSelected) {
return;
Expand Down
5 changes: 0 additions & 5 deletions packages/hms-video-store/src/device-manager/DeviceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,15 @@ export class DeviceManager implements HMSDeviceManager {
// if manually selected device is not available, reset on the track
this.store.getLocalPeer()?.audioTrack?.resetManuallySelectedDeviceId();
const defaultDevice = this.audioInput.find(device => device.deviceId === 'default');
console.log('getNewAudioInputDevice> default device ', defaultDevice);
if (defaultDevice) {
// Selecting a non-default device so that the deviceId comparision does not give
// false positives when device is removed, because the other available device
// get's the deviceId as default once this device is removed
const nextDevice = this.audioInput.find(device => {
return device.deviceId !== 'default' && defaultDevice.label.includes(device.label);
});
console.log('getNewAudioInputDevice> default device ', nextDevice);
return nextDevice;
}
console.log('getNewAudioInputDevice> input zeor device ', this.audioInput[0]);
return this.audioInput[0];
}

Expand All @@ -275,7 +272,6 @@ export class DeviceManager implements HMSDeviceManager {
const inputDevice = this.getNewAudioInputDevice();
const prevSelection = this.createIdentifier(this.outputDevice);
this.outputDevice = this.getAudioOutputDeviceMatchingInput(inputDevice);
console.log('setoutputDevice> input device, prevSelection ', inputDevice, prevSelection);
if (!this.outputDevice) {
// there is no matching device, let's revert back to the prev selected device
this.outputDevice = this.audioOutput.find(device => this.createIdentifier(device) === prevSelection);
Expand All @@ -284,7 +280,6 @@ export class DeviceManager implements HMSDeviceManager {
this.outputDevice = this.audioOutput.find(device => device.deviceId === 'default') || this.audioOutput[0];
}
}
console.log('setoutputDevice> outputDevice ', this.outputDevice);
await this.store.updateAudioOutputDevice(this.outputDevice);
// send event only on device change and device is not same as previous
if (deviceChange && prevSelection !== this.createIdentifier(this.outputDevice)) {
Expand Down

0 comments on commit 13618a4

Please sign in to comment.