@vapi-ai/web 1.0.199 → 1.0.200

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.
Files changed (3) hide show
  1. package/dist/vapi.js +10 -10
  2. package/package.json +1 -1
  3. package/vapi.ts +7 -8
package/dist/vapi.js CHANGED
@@ -39,10 +39,8 @@ function buildAudioPlayer(track, participantId) {
39
39
  });
40
40
  }
41
41
  function subscribeToTracks(e, call) {
42
- console.log(e);
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
- if (e.track.kind === "audio" && e.participant) {
96
- yield buildAudioPlayer(e.track, e.participant.session_id);
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
- (_c = this.call) === null || _c === void 0 ? void 0 : _c.sendAppMessage("playable");
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "1.0.199",
3
+ "version": "1.0.200",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
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
- console.log(e);
35
- if (e.participant.user_id === "local") {
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.track.kind === "audio" && e.participant) {
94
- await buildAudioPlayer(e.track, e.participant.session_id);
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");