Skip to content

Commit f47b88a

Browse files
committed
upgrade daily.js version + increaseMicLevel
1 parent 0350aad commit f47b88a

File tree

3 files changed

+82
-83
lines changed

3 files changed

+82
-83
lines changed

package-lock.json

Lines changed: 54 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vapi-ai/web",
3-
"version": "2.2.2",
3+
"version": "2.2.3",
44
"description": "",
55
"main": "dist/vapi.js",
66
"types": "dist/vapi.d.ts",
@@ -22,7 +22,7 @@
2222
},
2323
"homepage": "https://github.com/VapiAI/web#readme",
2424
"dependencies": {
25-
"@daily-co/daily-js": "^0.72.1",
25+
"@daily-co/daily-js": "^0.75.2",
2626
"events": "^3.3.0"
2727
},
2828
"devDependencies": {

vapi.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,32 @@ export default class Vapi extends VapiEventEmitter {
469469
this.call?.setInputDevicesAsync(options);
470470
}
471471

472+
public async increaseMicLevel(gain: number) {
473+
if (!this.call) {
474+
throw new Error('Call object is not available.');
475+
}
476+
477+
try {
478+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
479+
const audioContext = new AudioContext();
480+
481+
const source = audioContext.createMediaStreamSource(stream);
482+
483+
const gainNode = audioContext.createGain();
484+
gainNode.gain.value = gain;
485+
486+
source.connect(gainNode);
487+
488+
const destination = audioContext.createMediaStreamDestination();
489+
gainNode.connect(destination);
490+
491+
const [boostedTrack] = destination.stream.getAudioTracks();
492+
await this.call.setInputDevicesAsync({ audioSource: boostedTrack });
493+
} catch (error) {
494+
console.error("Error adjusting microphone level:", error);
495+
}
496+
}
497+
472498
public setOutputDeviceAsync(
473499
options: Parameters<DailyCall['setOutputDeviceAsync']>[0],
474500
) {

0 commit comments

Comments
 (0)