@vapi-ai/web 1.0.92 → 1.0.93

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/player.js +10 -8
  2. package/package.json +1 -1
  3. package/player.ts +14 -12
package/dist/player.js CHANGED
@@ -42,19 +42,22 @@ class ContinuousPlayer extends events_1.default {
42
42
  this.operationsQueue.push(() => this.appendNextChunk(audioData));
43
43
  }
44
44
  performBufferOperation(operation) {
45
- console.log("performBufferOperation");
46
45
  return new Promise((resolve) => {
47
46
  if (!this.sourceBuffer) {
48
47
  resolve();
49
48
  return;
50
49
  }
51
- this.sourceBuffer.addEventListener("updateend", () => {
52
- console.log("update end");
53
- resolve();
54
- }, {
55
- once: true,
56
- });
50
+ if (this.sourceBuffer.updating) {
51
+ this.sourceBuffer.addEventListener("updateend", () => {
52
+ operation();
53
+ resolve();
54
+ }, {
55
+ once: true,
56
+ });
57
+ return;
58
+ }
57
59
  operation();
60
+ resolve();
58
61
  });
59
62
  }
60
63
  appendNextChunk(chunk) {
@@ -96,7 +99,6 @@ class ContinuousPlayer extends events_1.default {
96
99
  });
97
100
  }
98
101
  clear() {
99
- console.log("oyoiyo");
100
102
  this.operationsQueue.push(() => this.abortBuffer());
101
103
  this.operationsQueue.push(() => this.removeBuffer());
102
104
  this.operationsQueue.push(() => this.resetTimestampOffset());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
package/player.ts CHANGED
@@ -44,25 +44,28 @@ export class ContinuousPlayer extends EventEmitter {
44
44
  }
45
45
 
46
46
  private performBufferOperation(operation: () => void) {
47
- console.log("performBufferOperation");
48
47
  return new Promise<void>((resolve) => {
49
48
  if (!this.sourceBuffer) {
50
49
  resolve();
51
50
  return;
52
51
  }
53
52
 
54
- this.sourceBuffer.addEventListener(
55
- "updateend",
56
- () => {
57
- console.log("update end");
58
- resolve();
59
- },
60
- {
61
- once: true,
62
- }
63
- );
53
+ if (this.sourceBuffer.updating) {
54
+ this.sourceBuffer.addEventListener(
55
+ "updateend",
56
+ () => {
57
+ operation();
58
+ resolve();
59
+ },
60
+ {
61
+ once: true,
62
+ }
63
+ );
64
+ return;
65
+ }
64
66
 
65
67
  operation();
68
+ resolve();
66
69
  });
67
70
  }
68
71
 
@@ -102,7 +105,6 @@ export class ContinuousPlayer extends EventEmitter {
102
105
  }
103
106
 
104
107
  clear() {
105
- console.log("oyoiyo");
106
108
  this.operationsQueue.push(() => this.abortBuffer());
107
109
  this.operationsQueue.push(() => this.removeBuffer());
108
110
  this.operationsQueue.push(() => this.resetTimestampOffset());