@vapi-ai/web 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/api.ts +13798 -10177
  2. package/package.json +3 -3
  3. package/vapi.ts +26 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
@@ -8,7 +8,7 @@
8
8
  "test": "jest",
9
9
  "build": "tsc && tsc --declaration",
10
10
  "start": "npm run generate-api && npm run build && node dist/vapi.js",
11
- "generate-api": "npx swagger-typescript-api -p https://api.vapi.ai/api-json -o . -n api.ts",
11
+ "generate-api": "npx swagger-typescript-api -p https://api.vapi.ai/api-extended-json -o . -n api.ts",
12
12
  "update": "./update.sh"
13
13
  },
14
14
  "repository": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "homepage": "https://github.com/VapiAI/web#readme",
24
24
  "dependencies": {
25
- "@daily-co/daily-js": "^0.72.1",
25
+ "@daily-co/daily-js": "^0.75.2",
26
26
  "events": "^3.3.0"
27
27
  },
28
28
  "devDependencies": {
package/vapi.ts CHANGED
@@ -469,6 +469,32 @@ export default class Vapi extends VapiEventEmitter {
469
469
  this.call?.setInputDevicesAsync(options);
470
470
  }
471
471
 
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
+
472
498
  public setOutputDeviceAsync(
473
499
  options: Parameters<DailyCall['setOutputDeviceAsync']>[0],
474
500
  ) {