From f28edb279bf696643b230e7e2982cdcccee8fd96 Mon Sep 17 00:00:00 2001 From: Kesari3008 <65543166+Kesari3008@users.noreply.github.com> Date: Thu, 5 Oct 2023 22:16:28 +0530 Subject: [PATCH] feat(callingsdk): initial changes to add bnr (#3120) Co-authored-by: Priya Kesari --- docs/samples/calling/app.js | 23 ++++++++++++++++++- docs/samples/calling/index.html | 10 ++++++-- packages/@webex/media-helpers/package.json | 2 +- .../calling/src/CallingClient/calling/call.ts | 19 +++++++++++---- packages/calling/src/index.ts | 7 +++--- packages/webex/src/calling.js | 4 ++++ yarn.lock | 21 ++++++++++++----- 7 files changed, 68 insertions(+), 18 deletions(-) diff --git a/docs/samples/calling/app.js b/docs/samples/calling/app.js index 0eb666363f5..b8f75e9f1dd 100644 --- a/docs/samples/calling/app.js +++ b/docs/samples/calling/app.js @@ -92,6 +92,7 @@ let call; let callTranferObj; let broadworksCorrelationInfo; let localAudioStream; +let effect; const devicesById = {}; const img = new Image(); @@ -611,10 +612,30 @@ function initiateTransfer() { async function getMediaStreams() { localAudioStream = await Calling.createMicrophoneStream({audio: true}); + localAudioElem.srcObject = localAudioStream.outputStream; makeCallBtn.disabled = false; } +async function addNoiseReductionEffect() { + effect = await localAudioStream.getEffect('background-noise-removal'); + + if (!effect) { + effect = await Calling.createNoiseReductionEffect(tokenElm.value); + + await localAudioStream.addEffect('background-noise-removal', effect); + } + + await effect.enable(); +} + +async function removeNoiseReductionEffect() { + effect = await localAudioStream.getEffect('background-noise-removal'); + if (effect) { + await effect.disable(); + } +} + // Listen for submit on create meeting createCallForm.addEventListener('submit', createCall); @@ -634,7 +655,7 @@ function clearMediaDeviceList() { } async function getMediaDevices() { - const cameras = await callingClient.mediaEngine.Media.getCameras(); + const cameras = await callingClient.mediaEngine.Media.getCameras(); cameras.forEach((camera) => { populateSourceDevices(camera); }); diff --git a/docs/samples/calling/index.html b/docs/samples/calling/index.html index 19bdb2ba66b..f9be1edbab7 100644 --- a/docs/samples/calling/index.html +++ b/docs/samples/calling/index.html @@ -49,7 +49,7 @@

Authentication



Note: Please update these before calling.init() if want to use different values.

- +