@vapi-ai/web 1.0.178 → 1.0.180

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 +8 -1
  2. package/package.json +1 -1
  3. package/vapi.ts +10 -1
package/dist/vapi.js CHANGED
@@ -42,6 +42,12 @@ class Vapi extends events_1.default {
42
42
  videoSource: false,
43
43
  });
44
44
  (_a = this.call.iframe()) === null || _a === void 0 ? void 0 : _a.style.setProperty("display", "none");
45
+ this.call.on("joined-meeting", () => {
46
+ this.emit("call-started");
47
+ });
48
+ this.call.on("left-meeting", () => {
49
+ this.emit("call-stopped");
50
+ });
45
51
  yield this.call.join({ url });
46
52
  this.call.startRemoteParticipantsAudioLevelObserver();
47
53
  this.call.on("remote-participants-audio-level", (e) => this.handleRemoteParticipantsAudioLevel(e));
@@ -51,7 +57,7 @@ class Vapi extends events_1.default {
51
57
  });
52
58
  }
53
59
  handleRemoteParticipantsAudioLevel(e) {
54
- const isSpeaking = Object.values(e.participantsAudioLevel).some((v) => v > 0.005);
60
+ const isSpeaking = Object.values(e.participantsAudioLevel).some((v) => v > 0.01);
55
61
  if (!isSpeaking)
56
62
  return;
57
63
  if (this.speakingTimeout) {
@@ -63,6 +69,7 @@ class Vapi extends events_1.default {
63
69
  }
64
70
  this.speakingTimeout = setTimeout(() => {
65
71
  this.emit("speech-end");
72
+ this.speakingTimeout = null;
66
73
  }, 500);
67
74
  }
68
75
  stop() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "1.0.178",
3
+ "version": "1.0.180",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
package/vapi.ts CHANGED
@@ -39,6 +39,14 @@ export default class Vapi extends EventEmitter {
39
39
  videoSource: false,
40
40
  });
41
41
  this.call.iframe()?.style.setProperty("display", "none");
42
+
43
+ this.call.on("joined-meeting", () => {
44
+ this.emit("call-started");
45
+ });
46
+ this.call.on("left-meeting", () => {
47
+ this.emit("call-stopped");
48
+ });
49
+
42
50
  await this.call.join({ url });
43
51
 
44
52
  this.call.startRemoteParticipantsAudioLevelObserver();
@@ -55,7 +63,7 @@ export default class Vapi extends EventEmitter {
55
63
  e: DailyEventObjectRemoteParticipantsAudioLevel
56
64
  ) {
57
65
  const isSpeaking = Object.values(e.participantsAudioLevel).some(
58
- (v) => v > 0.005
66
+ (v) => v > 0.01
59
67
  );
60
68
  if (!isSpeaking) return;
61
69
 
@@ -68,6 +76,7 @@ export default class Vapi extends EventEmitter {
68
76
 
69
77
  this.speakingTimeout = setTimeout(() => {
70
78
  this.emit("speech-end");
79
+ this.speakingTimeout = null;
71
80
  }, 500);
72
81
  }
73
82