@vapi-ai/web 2.2.3 → 2.2.4

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.
package/dist/vapi.d.ts CHANGED
@@ -57,6 +57,7 @@ export default class Vapi extends VapiEventEmitter {
57
57
  isMuted(): boolean;
58
58
  say(message: string, endCallAfterSpoken?: boolean): void;
59
59
  setInputDevicesAsync(options: Parameters<DailyCall['setInputDevicesAsync']>[0]): void;
60
+ increaseMicLevel(gain: number): Promise<void>;
60
61
  setOutputDeviceAsync(options: Parameters<DailyCall['setOutputDeviceAsync']>[0]): void;
61
62
  getDailyCallObject(): DailyCall | null;
62
63
  startScreenSharing(displayMediaOptions?: DisplayMediaStreamOptions, screenVideoSendSettings?: DailyVideoSendSettings): void;
package/dist/vapi.js CHANGED
@@ -313,6 +313,26 @@ class Vapi extends VapiEventEmitter {
313
313
  setInputDevicesAsync(options) {
314
314
  this.call?.setInputDevicesAsync(options);
315
315
  }
316
+ async increaseMicLevel(gain) {
317
+ if (!this.call) {
318
+ throw new Error('Call object is not available.');
319
+ }
320
+ try {
321
+ const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
322
+ const audioContext = new AudioContext();
323
+ const source = audioContext.createMediaStreamSource(stream);
324
+ const gainNode = audioContext.createGain();
325
+ gainNode.gain.value = gain;
326
+ source.connect(gainNode);
327
+ const destination = audioContext.createMediaStreamDestination();
328
+ gainNode.connect(destination);
329
+ const [boostedTrack] = destination.stream.getAudioTracks();
330
+ await this.call.setInputDevicesAsync({ audioSource: boostedTrack });
331
+ }
332
+ catch (error) {
333
+ console.error("Error adjusting microphone level:", error);
334
+ }
335
+ }
316
336
  setOutputDeviceAsync(options) {
317
337
  this.call?.setOutputDeviceAsync(options);
318
338
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",