File tree Expand file tree Collapse file tree 3 files changed +82
-83
lines changed
Expand file tree Collapse file tree 3 files changed +82
-83
lines changed Original file line number Diff line number Diff line change 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" ,
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" : {
Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments