@vapi-ai/web 1.0.89 → 1.0.91

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/player.js CHANGED
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -33,12 +42,16 @@ class ContinuousPlayer extends events_1.default {
33
42
  this.operationsQueue.push(() => this.appendNextChunk(audioData));
34
43
  }
35
44
  performBufferOperation(operation) {
45
+ console.log("performBufferOperation");
36
46
  return new Promise((resolve) => {
37
47
  if (!this.sourceBuffer) {
38
48
  resolve();
39
49
  return;
40
50
  }
41
- this.sourceBuffer.addEventListener("updateend", () => resolve(), {
51
+ this.sourceBuffer.addEventListener("updateend", () => {
52
+ console.log("update end");
53
+ resolve();
54
+ }, {
42
55
  once: true,
43
56
  });
44
57
  operation();
@@ -71,10 +84,10 @@ class ContinuousPlayer extends events_1.default {
71
84
  });
72
85
  }
73
86
  abortBuffer() {
74
- console.log("abortBuffer");
75
- return this.performBufferOperation(() => {
87
+ return __awaiter(this, void 0, void 0, function* () {
76
88
  if (!this.sourceBuffer)
77
89
  return;
90
+ // This does not emit updateend
78
91
  this.sourceBuffer.abort();
79
92
  });
80
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
package/player.ts CHANGED
@@ -44,15 +44,23 @@ export class ContinuousPlayer extends EventEmitter {
44
44
  }
45
45
 
46
46
  private performBufferOperation(operation: () => void) {
47
+ console.log("performBufferOperation");
47
48
  return new Promise<void>((resolve) => {
48
49
  if (!this.sourceBuffer) {
49
50
  resolve();
50
51
  return;
51
52
  }
52
53
 
53
- this.sourceBuffer.addEventListener("updateend", () => resolve(), {
54
- once: true,
55
- });
54
+ this.sourceBuffer.addEventListener(
55
+ "updateend",
56
+ () => {
57
+ console.log("update end");
58
+ resolve();
59
+ },
60
+ {
61
+ once: true,
62
+ }
63
+ );
56
64
 
57
65
  operation();
58
66
  });
@@ -84,12 +92,10 @@ export class ContinuousPlayer extends EventEmitter {
84
92
  });
85
93
  }
86
94
 
87
- private abortBuffer() {
88
- console.log("abortBuffer");
89
- return this.performBufferOperation(() => {
90
- if (!this.sourceBuffer) return;
91
- this.sourceBuffer.abort();
92
- });
95
+ private async abortBuffer() {
96
+ if (!this.sourceBuffer) return;
97
+ // This does not emit updateend
98
+ this.sourceBuffer.abort();
93
99
  }
94
100
 
95
101
  clear() {