@vapi-ai/web 1.0.55 → 1.0.57

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
@@ -32,10 +32,11 @@ class ContinuousPlayer extends events_1.default {
32
32
  }
33
33
  appendNextChunk(chunk, callback) {
34
34
  if (this.sourceBuffer && !this.sourceBuffer.updating) {
35
- if (this.sourceBuffer.buffered.length > 0) {
36
- this.sourceBuffer.timestampOffset = this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length - 1);
35
+ // Set the timestampOffset to the end of the currently buffered data
36
+ if (this.sourceBuffer.buffered.length) {
37
+ const lastBufferedEndTime = this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length - 1);
38
+ this.sourceBuffer.timestampOffset = lastBufferedEndTime;
37
39
  }
38
- console.log("appending", this.sourceBuffer.timestampOffset);
39
40
  this.sourceBuffer.appendBuffer(chunk);
40
41
  this.audioQueue.pause();
41
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
package/player.ts CHANGED
@@ -44,18 +44,19 @@ export class ContinuousPlayer extends EventEmitter {
44
44
  callback: async.ErrorCallback<Error>
45
45
  ): void {
46
46
  if (this.sourceBuffer && !this.sourceBuffer.updating) {
47
- if (this.sourceBuffer.buffered.length > 0) {
48
- this.sourceBuffer.timestampOffset = this.sourceBuffer.buffered.end(
47
+ // Set the timestampOffset to the end of the currently buffered data
48
+ if (this.sourceBuffer.buffered.length) {
49
+ const lastBufferedEndTime = this.sourceBuffer.buffered.end(
49
50
  this.sourceBuffer.buffered.length - 1
50
51
  );
52
+ this.sourceBuffer.timestampOffset = lastBufferedEndTime;
51
53
  }
52
- console.log("appending", this.sourceBuffer.timestampOffset);
54
+
53
55
  this.sourceBuffer.appendBuffer(chunk);
54
56
  this.audioQueue.pause();
55
57
  }
56
58
  callback();
57
59
  }
58
-
59
60
  clear(): void {
60
61
  if (this.sourceBuffer) {
61
62
  if (this.sourceBuffer.updating) {