@vapi-ai/web 1.3.0 → 1.4.1

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 CHANGED
@@ -9,7 +9,8 @@ export interface AddMessageMessage {
9
9
  }
10
10
  export interface ControlMessages {
11
11
  type: 'control';
12
- control: 'mute-assistant' | 'unmute-assistant';
12
+ control: 'mute-assistant' | 'unmute-assistant' | 'say-first-message';
13
+ videoRecordingStartDelay?: number;
13
14
  }
14
15
  export interface SayMessage {
15
16
  type: 'say';
package/dist/vapi.js CHANGED
@@ -90,8 +90,7 @@ class Vapi extends VapiEventEmitter {
90
90
  if (this.call) {
91
91
  this.cleanup();
92
92
  }
93
- const isVideoRecordingEnabled = webCall?.artifactPlan?.videoRecordingEnabled ??
94
- false;
93
+ const isVideoRecordingEnabled = webCall?.artifactPlan?.videoRecordingEnabled ?? false;
95
94
  this.call = daily_js_1.default.createCallObject({
96
95
  audioSource: true,
97
96
  videoSource: isVideoRecordingEnabled,
@@ -140,7 +139,8 @@ class Vapi extends VapiEventEmitter {
140
139
  subscribeToTracksAutomatically: false,
141
140
  });
142
141
  if (isVideoRecordingEnabled) {
143
- await this.call.startRecording({
142
+ const recordingRequestedTime = new Date().getTime();
143
+ this.call.startRecording({
144
144
  width: 1280,
145
145
  height: 720,
146
146
  backgroundColor: '#FF1F2D3D',
@@ -148,6 +148,13 @@ class Vapi extends VapiEventEmitter {
148
148
  preset: 'default',
149
149
  },
150
150
  });
151
+ this.call.on('recording-started', () => {
152
+ this.send({
153
+ type: 'control',
154
+ control: 'say-first-message',
155
+ videoRecordingStartDelay: new Date().getTime() - recordingRequestedTime,
156
+ });
157
+ });
151
158
  }
152
159
  this.call.startRemoteParticipantsAudioLevelObserver(100);
153
160
  this.call.on('remote-participants-audio-level', (e) => {
@@ -260,7 +267,7 @@ class Vapi extends VapiEventEmitter {
260
267
  this.send({
261
268
  type: 'say',
262
269
  message,
263
- endCallAfterSpoken
270
+ endCallAfterSpoken,
264
271
  });
265
272
  }
266
273
  setInputDevicesAsync(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "homepage": "https://github.com/VapiAI/web#readme",
24
24
  "dependencies": {
25
- "@daily-co/daily-js": "^0.58.0",
25
+ "@daily-co/daily-js": "^0.66.0",
26
26
  "@vapi-ai/web": "^1.0.263",
27
27
  "events": "^3.3.0"
28
28
  },
package/update.sh CHANGED
@@ -1 +1 @@
1
- npm version minor && npm run build && npm publish && cd ../landing && npm install @vapi-ai/web@latest && cd -
1
+ npm version patch && npm run build && npm publish && cd ../landing && npm install @vapi-ai/web@latest && cd -
package/vapi.ts CHANGED
@@ -29,7 +29,11 @@ async function buildAudioPlayer(track: any, participantId: string) {
29
29
  await startPlayer(player, track);
30
30
  return player;
31
31
  }
32
- function subscribeToTracks(e: DailyEventObjectParticipant, call: DailyCall, isVideoRecordingEnabled?: boolean) {
32
+ function subscribeToTracks(
33
+ e: DailyEventObjectParticipant,
34
+ call: DailyCall,
35
+ isVideoRecordingEnabled?: boolean,
36
+ ) {
33
37
  if (e.participant.local) return;
34
38
 
35
39
  call.updateParticipant(e.participant.session_id, {
@@ -47,7 +51,8 @@ export interface AddMessageMessage {
47
51
 
48
52
  export interface ControlMessages {
49
53
  type: 'control';
50
- control: 'mute-assistant' | 'unmute-assistant';
54
+ control: 'mute-assistant' | 'unmute-assistant' | 'say-first-message';
55
+ videoRecordingStartDelay?: number;
51
56
  }
52
57
 
53
58
  export interface SayMessage {
@@ -145,9 +150,7 @@ export default class Vapi extends VapiEventEmitter {
145
150
  if (this.call) {
146
151
  this.cleanup();
147
152
  }
148
- const isVideoRecordingEnabled =
149
- webCall?.artifactPlan?.videoRecordingEnabled ??
150
- false;
153
+ const isVideoRecordingEnabled = webCall?.artifactPlan?.videoRecordingEnabled ?? false;
151
154
 
152
155
  this.call = DailyIframe.createCallObject({
153
156
  audioSource: true,
@@ -201,7 +204,9 @@ export default class Vapi extends VapiEventEmitter {
201
204
  });
202
205
 
203
206
  if (isVideoRecordingEnabled) {
204
- await this.call.startRecording({
207
+ const recordingRequestedTime = new Date().getTime();
208
+
209
+ this.call.startRecording({
205
210
  width: 1280,
206
211
  height: 720,
207
212
  backgroundColor: '#FF1F2D3D',
@@ -209,6 +214,14 @@ export default class Vapi extends VapiEventEmitter {
209
214
  preset: 'default',
210
215
  },
211
216
  });
217
+
218
+ this.call.on('recording-started', () => {
219
+ this.send({
220
+ type: 'control',
221
+ control: 'say-first-message',
222
+ videoRecordingStartDelay: new Date().getTime() - recordingRequestedTime,
223
+ });
224
+ });
212
225
  }
213
226
 
214
227
  this.call.startRemoteParticipantsAudioLevelObserver(100);
@@ -327,18 +340,17 @@ export default class Vapi extends VapiEventEmitter {
327
340
 
328
341
  public say(message: string, endCallAfterSpoken?: boolean) {
329
342
  this.send({
330
- type:'say',
343
+ type: 'say',
331
344
  message,
332
- endCallAfterSpoken
333
- })
345
+ endCallAfterSpoken,
346
+ });
334
347
  }
335
348
 
336
-
337
349
  public setInputDevicesAsync(options: Parameters<DailyCall['setInputDevicesAsync']>[0]) {
338
- this.call?.setInputDevicesAsync(options)
350
+ this.call?.setInputDevicesAsync(options);
339
351
  }
340
352
 
341
353
  public setOutputDeviceAsync(options: Parameters<DailyCall['setOutputDeviceAsync']>[0]) {
342
- this.call?.setOutputDeviceAsync(options)
354
+ this.call?.setOutputDeviceAsync(options);
343
355
  }
344
356
  }