@vapi-ai/web 1.0.155 → 1.0.157
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 +1 -1
- package/dist/vapi.js +11 -5
- package/package.json +1 -1
- package/vapi.ts +10 -11
package/dist/vapi.d.ts
CHANGED
package/dist/vapi.js
CHANGED
|
@@ -33,16 +33,22 @@ class Vapi extends events_1.default {
|
|
|
33
33
|
});
|
|
34
34
|
(_a = this.call.iframe()) === null || _a === void 0 ? void 0 : _a.style.setProperty("display", "none");
|
|
35
35
|
this.call.join({ url });
|
|
36
|
-
this.call.on("
|
|
37
|
-
this.call.startRemoteParticipantsAudioLevelObserver(500);
|
|
36
|
+
this.call.on("active-speaker-change", (e) => this.handleSpeakerChange(e));
|
|
38
37
|
})
|
|
39
38
|
.catch((error) => {
|
|
40
39
|
console.error(error);
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
console.log(
|
|
42
|
+
handleSpeakerChange(speaker) {
|
|
43
|
+
var _a, _b, _c, _d;
|
|
44
|
+
console.log(speaker);
|
|
45
|
+
console.log((_a = this.call) === null || _a === void 0 ? void 0 : _a.participants());
|
|
46
|
+
if ((speaker === null || speaker === void 0 ? void 0 : speaker.userId) === ((_d = (_c = (_b = this.call) === null || _b === void 0 ? void 0 : _b.participants()) === null || _c === void 0 ? void 0 : _c.local) === null || _d === void 0 ? void 0 : _d.user_id)) {
|
|
47
|
+
this.emit("speech-end");
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.emit("speech-start");
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
stop() {
|
|
48
54
|
var _a;
|
package/package.json
CHANGED
package/vapi.ts
CHANGED
|
@@ -36,24 +36,23 @@ export default class Vapi extends EventEmitter {
|
|
|
36
36
|
this.call.iframe()?.style.setProperty("display", "none");
|
|
37
37
|
this.call.join({ url });
|
|
38
38
|
|
|
39
|
-
this.call.on(
|
|
40
|
-
|
|
41
|
-
(participantsAudioLevel) =>
|
|
42
|
-
this.handleParticipantsAudioLevel(participantsAudioLevel)
|
|
39
|
+
this.call.on("active-speaker-change", (e) =>
|
|
40
|
+
this.handleSpeakerChange(e)
|
|
43
41
|
);
|
|
44
|
-
this.call.startRemoteParticipantsAudioLevelObserver(500);
|
|
45
42
|
})
|
|
46
43
|
.catch((error) => {
|
|
47
44
|
console.error(error);
|
|
48
45
|
});
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
private
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
private handleSpeakerChange(speaker: any) {
|
|
49
|
+
console.log(speaker);
|
|
50
|
+
console.log(this.call?.participants());
|
|
51
|
+
if (speaker?.userId === this.call?.participants()?.local?.user_id) {
|
|
52
|
+
this.emit("speech-end");
|
|
53
|
+
} else {
|
|
54
|
+
this.emit("speech-start");
|
|
55
|
+
}
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
stop(): void {
|