Skip to content

Commit

Permalink
fix: remove redundant method
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed Nov 22, 2024
1 parent 5a11e75 commit bef3fb9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,6 @@ export class HMSAudioTrackSettingsBuilder {
return this;
}

updateConstraints(overrides: Partial<Array<MediaTrackConstraintSet>>) {
const constraintsMap = new Map<string, MediaTrackConstraintSet>();
this._advanced.forEach(constraint => {
const key = Object.keys(constraint)[0];
constraintsMap.set(key, constraint);
});

Object.entries(overrides).forEach(([key, value]) => {
if (value !== undefined) {
// @ts-ignore
constraintsMap.set(key, { [key]: { exact: value['exact'] } });
}
});

this._advanced = Array.from(constraintsMap.values());
return this;
}

advanced(advanced: Array<MediaTrackConstraintSet>) {
this._advanced = advanced;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,20 @@ export class HMSAudioPluginsManager {
.codec(settings.codec)
.maxBitrate(settings.maxBitrate)
.deviceId(settings.deviceId!)
.updateConstraints([{ autoGainControl: { exact: false } }, { noiseSuppression: { exact: false } }])
.advanced([
// @ts-ignore
{ googEchoCancellation: { exact: true } },
// @ts-ignore
{ googExperimentalEchoCancellation: { exact: true } },
// @ts-ignore
{ autoGainControl: { exact: false } },
// @ts-ignore
{ noiseSuppression: { exact: false } },
// @ts-ignore
{ googHighpassFilter: { exact: true } },
// @ts-ignore
{ googAudioMirroring: { exact: true } },
])
.audioMode(settings.audioMode)
.build();
await this.hmsTrack.setSettings(newAudioTrackSettings);
Expand Down Expand Up @@ -180,7 +193,20 @@ export class HMSAudioPluginsManager {
.codec(settings.codec)
.maxBitrate(settings.maxBitrate)
.deviceId(settings.deviceId!)
.updateConstraints([{ autoGainControl: { exact: true } }, { noiseSuppression: { exact: true } }])
.advanced([
// @ts-ignore
{ googEchoCancellation: { exact: true } },
// @ts-ignore
{ googExperimentalEchoCancellation: { exact: true } },
// @ts-ignore
{ autoGainControl: { exact: true } },
// @ts-ignore
{ noiseSuppression: { exact: true } },
// @ts-ignore
{ googHighpassFilter: { exact: true } },
// @ts-ignore
{ googAudioMirroring: { exact: true } },
])
.audioMode(settings.audioMode)
.build();
await this.hmsTrack.setSettings(newAudioTrackSettings);
Expand Down

0 comments on commit bef3fb9

Please sign in to comment.