@vapi-ai/web 1.0.214 → 1.0.216
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/README.md +4 -0
- package/dist/vapi.js +5 -3
- package/package.json +1 -1
- package/vapi.ts +8 -4
package/README.md
CHANGED
package/dist/vapi.js
CHANGED
|
@@ -109,7 +109,7 @@ class Vapi extends events_1.default {
|
|
|
109
109
|
url: webCallUrl,
|
|
110
110
|
subscribeToTracksAutomatically: false,
|
|
111
111
|
});
|
|
112
|
-
this.call.startRemoteParticipantsAudioLevelObserver();
|
|
112
|
+
this.call.startRemoteParticipantsAudioLevelObserver(100);
|
|
113
113
|
this.call.on("remote-participants-audio-level", (e) => this.handleRemoteParticipantsAudioLevel(e));
|
|
114
114
|
this.call.updateInputSettings({
|
|
115
115
|
audio: {
|
|
@@ -126,7 +126,9 @@ class Vapi extends events_1.default {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
handleRemoteParticipantsAudioLevel(e) {
|
|
129
|
-
const
|
|
129
|
+
const speechLevel = Object.values(e.participantsAudioLevel).reduce((a, b) => a + b, 0);
|
|
130
|
+
this.emit("volume-level", speechLevel);
|
|
131
|
+
const isSpeaking = speechLevel > 0.1;
|
|
130
132
|
if (!isSpeaking)
|
|
131
133
|
return;
|
|
132
134
|
if (this.speakingTimeout) {
|
|
@@ -139,7 +141,7 @@ class Vapi extends events_1.default {
|
|
|
139
141
|
this.speakingTimeout = setTimeout(() => {
|
|
140
142
|
this.emit("speech-end");
|
|
141
143
|
this.speakingTimeout = null;
|
|
142
|
-
},
|
|
144
|
+
}, 1000);
|
|
143
145
|
}
|
|
144
146
|
stop() {
|
|
145
147
|
var _a;
|
package/package.json
CHANGED
package/vapi.ts
CHANGED
|
@@ -108,7 +108,7 @@ export default class Vapi extends EventEmitter {
|
|
|
108
108
|
subscribeToTracksAutomatically: false,
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
this.call.startRemoteParticipantsAudioLevelObserver();
|
|
111
|
+
this.call.startRemoteParticipantsAudioLevelObserver(100);
|
|
112
112
|
this.call.on("remote-participants-audio-level", (e) =>
|
|
113
113
|
this.handleRemoteParticipantsAudioLevel(e)
|
|
114
114
|
);
|
|
@@ -131,9 +131,13 @@ export default class Vapi extends EventEmitter {
|
|
|
131
131
|
private handleRemoteParticipantsAudioLevel(
|
|
132
132
|
e: DailyEventObjectRemoteParticipantsAudioLevel
|
|
133
133
|
) {
|
|
134
|
-
const
|
|
135
|
-
(
|
|
134
|
+
const speechLevel = Object.values(e.participantsAudioLevel).reduce(
|
|
135
|
+
(a, b) => a + b,
|
|
136
|
+
0
|
|
136
137
|
);
|
|
138
|
+
this.emit("volume-level", speechLevel);
|
|
139
|
+
|
|
140
|
+
const isSpeaking = speechLevel > 0.1;
|
|
137
141
|
if (!isSpeaking) return;
|
|
138
142
|
|
|
139
143
|
if (this.speakingTimeout) {
|
|
@@ -146,7 +150,7 @@ export default class Vapi extends EventEmitter {
|
|
|
146
150
|
this.speakingTimeout = setTimeout(() => {
|
|
147
151
|
this.emit("speech-end");
|
|
148
152
|
this.speakingTimeout = null;
|
|
149
|
-
},
|
|
153
|
+
}, 1000);
|
|
150
154
|
}
|
|
151
155
|
|
|
152
156
|
stop(): void {
|