@vapi-ai/web 1.0.91 → 1.0.92

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.d.ts CHANGED
@@ -10,6 +10,7 @@ export declare class ContinuousPlayer extends EventEmitter {
10
10
  playChunk(audioData: ArrayBuffer): void;
11
11
  private performBufferOperation;
12
12
  private appendNextChunk;
13
+ private removeBufferedRange;
13
14
  private removeBuffer;
14
15
  private resetTimestampOffset;
15
16
  private abortBuffer;
package/dist/player.js CHANGED
@@ -58,25 +58,29 @@ class ContinuousPlayer extends events_1.default {
58
58
  });
59
59
  }
60
60
  appendNextChunk(chunk) {
61
- console.log("appendNextChunk");
62
61
  return this.performBufferOperation(() => {
63
62
  if (!this.sourceBuffer)
64
63
  return;
65
64
  this.sourceBuffer.appendBuffer(chunk);
66
65
  });
67
66
  }
68
- removeBuffer() {
69
- console.log("removeBuffer");
67
+ removeBufferedRange() {
70
68
  return this.performBufferOperation(() => {
69
+ if (!this.sourceBuffer)
70
+ return;
71
+ this.sourceBuffer.remove(0, this.sourceBuffer.buffered.end(0));
72
+ });
73
+ }
74
+ removeBuffer() {
75
+ return __awaiter(this, void 0, void 0, function* () {
71
76
  if (!this.sourceBuffer)
72
77
  return;
73
78
  while (this.sourceBuffer.buffered.length > 0) {
74
- this.sourceBuffer.remove(0, this.sourceBuffer.buffered.end(0));
79
+ yield this.removeBufferedRange();
75
80
  }
76
81
  });
77
82
  }
78
83
  resetTimestampOffset() {
79
- console.log("resetTimestampOffset");
80
84
  return this.performBufferOperation(() => {
81
85
  if (!this.sourceBuffer)
82
86
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "1.0.91",
3
+ "version": "1.0.92",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
package/player.ts CHANGED
@@ -67,25 +67,28 @@ export class ContinuousPlayer extends EventEmitter {
67
67
  }
68
68
 
69
69
  private appendNextChunk(chunk: ArrayBuffer) {
70
- console.log("appendNextChunk");
71
70
  return this.performBufferOperation(() => {
72
71
  if (!this.sourceBuffer) return;
73
72
  this.sourceBuffer.appendBuffer(chunk);
74
73
  });
75
74
  }
76
75
 
77
- private removeBuffer() {
78
- console.log("removeBuffer");
76
+ private removeBufferedRange() {
79
77
  return this.performBufferOperation(() => {
80
78
  if (!this.sourceBuffer) return;
81
- while (this.sourceBuffer.buffered.length > 0) {
82
- this.sourceBuffer.remove(0, this.sourceBuffer.buffered.end(0));
83
- }
79
+ this.sourceBuffer.remove(0, this.sourceBuffer.buffered.end(0));
84
80
  });
85
81
  }
86
82
 
83
+ private async removeBuffer() {
84
+ if (!this.sourceBuffer) return;
85
+
86
+ while (this.sourceBuffer.buffered.length > 0) {
87
+ await this.removeBufferedRange();
88
+ }
89
+ }
90
+
87
91
  private resetTimestampOffset() {
88
- console.log("resetTimestampOffset");
89
92
  return this.performBufferOperation(() => {
90
93
  if (!this.sourceBuffer) return;
91
94
  this.sourceBuffer.timestampOffset = 0;