@vapi-ai/web 1.0.199 → 1.0.201
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.js +11 -11
- package/package.json +1 -1
- package/vapi.ts +8 -9
package/dist/vapi.js
CHANGED
|
@@ -39,10 +39,8 @@ function buildAudioPlayer(track, participantId) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
function subscribeToTracks(e, call) {
|
|
42
|
-
|
|
43
|
-
if (e.participant.user_id === "local") {
|
|
42
|
+
if (e.participant.local)
|
|
44
43
|
return;
|
|
45
|
-
}
|
|
46
44
|
call.updateParticipant(e.participant.session_id, {
|
|
47
45
|
setSubscribedTracks: {
|
|
48
46
|
audio: true,
|
|
@@ -89,15 +87,17 @@ class Vapi extends events_1.default {
|
|
|
89
87
|
// Don't print to console
|
|
90
88
|
});
|
|
91
89
|
this.call.on("track-started", (e) => __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
var _b, _c;
|
|
93
|
-
if (!e)
|
|
90
|
+
var _b, _c, _d;
|
|
91
|
+
if (!e || !e.participant)
|
|
92
|
+
return;
|
|
93
|
+
if ((_b = e.participant) === null || _b === void 0 ? void 0 : _b.local)
|
|
94
|
+
return;
|
|
95
|
+
if (e.track.kind !== "audio")
|
|
94
96
|
return;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
if (((_b = e === null || e === void 0 ? void 0 : e.participant) === null || _b === void 0 ? void 0 : _b.user_name) !== "Vapi Speaker")
|
|
97
|
+
yield buildAudioPlayer(e.track, e.participant.session_id);
|
|
98
|
+
if (((_c = e === null || e === void 0 ? void 0 : e.participant) === null || _c === void 0 ? void 0 : _c.user_name) !== "Vapi Speaker")
|
|
99
99
|
return;
|
|
100
|
-
(
|
|
100
|
+
(_d = this.call) === null || _d === void 0 ? void 0 : _d.sendAppMessage("playable");
|
|
101
101
|
this.emit("call-start");
|
|
102
102
|
}));
|
|
103
103
|
this.call.on("participant-joined", (e) => {
|
|
@@ -105,7 +105,7 @@ class Vapi extends events_1.default {
|
|
|
105
105
|
return;
|
|
106
106
|
subscribeToTracks(e, this.call);
|
|
107
107
|
});
|
|
108
|
-
yield this.call.join({ url
|
|
108
|
+
yield this.call.join({ url });
|
|
109
109
|
this.call.startRemoteParticipantsAudioLevelObserver();
|
|
110
110
|
this.call.on("remote-participants-audio-level", (e) => this.handleRemoteParticipantsAudioLevel(e));
|
|
111
111
|
}))
|
package/package.json
CHANGED
package/vapi.ts
CHANGED
|
@@ -31,10 +31,8 @@ async function buildAudioPlayer(track: any, participantId: string) {
|
|
|
31
31
|
return player;
|
|
32
32
|
}
|
|
33
33
|
function subscribeToTracks(e: DailyEventObjectParticipant, call: DailyCall) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
34
|
+
if (e.participant.local) return;
|
|
35
|
+
|
|
38
36
|
call.updateParticipant(e.participant.session_id, {
|
|
39
37
|
setSubscribedTracks: {
|
|
40
38
|
audio: true,
|
|
@@ -89,10 +87,11 @@ export default class Vapi extends EventEmitter {
|
|
|
89
87
|
});
|
|
90
88
|
|
|
91
89
|
this.call.on("track-started", async (e) => {
|
|
92
|
-
if (!e) return;
|
|
93
|
-
if (e.
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
if (!e || !e.participant) return;
|
|
91
|
+
if (e.participant?.local) return;
|
|
92
|
+
if (e.track.kind !== "audio") return;
|
|
93
|
+
|
|
94
|
+
await buildAudioPlayer(e.track, e.participant.session_id);
|
|
96
95
|
|
|
97
96
|
if (e?.participant?.user_name !== "Vapi Speaker") return;
|
|
98
97
|
this.call?.sendAppMessage("playable");
|
|
@@ -104,7 +103,7 @@ export default class Vapi extends EventEmitter {
|
|
|
104
103
|
subscribeToTracks(e, this.call);
|
|
105
104
|
});
|
|
106
105
|
|
|
107
|
-
await this.call.join({ url
|
|
106
|
+
await this.call.join({ url });
|
|
108
107
|
|
|
109
108
|
this.call.startRemoteParticipantsAudioLevelObserver();
|
|
110
109
|
this.call.on("remote-participants-audio-level", (e) =>
|