@vapi-ai/web 1.0.75 → 1.0.77
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 +0 -1
- package/dist/player.js +1 -22
- package/package.json +3 -2
- package/player.ts +1 -27
- package/update.sh +1 -0
package/dist/player.d.ts
CHANGED
package/dist/player.js
CHANGED
|
@@ -19,10 +19,9 @@ class ContinuousPlayer extends events_1.default {
|
|
|
19
19
|
}, 1);
|
|
20
20
|
this.mediaSource.addEventListener("sourceopen", () => {
|
|
21
21
|
this.mediaSource.duration = Number.POSITIVE_INFINITY;
|
|
22
|
-
this.sourceBuffer = this.mediaSource.addSourceBuffer('audio/
|
|
22
|
+
this.sourceBuffer = this.mediaSource.addSourceBuffer('audio/ogg; codecs="opus"');
|
|
23
23
|
this.sourceBuffer.mode = "sequence";
|
|
24
24
|
this.sourceBuffer.addEventListener("updateend", () => {
|
|
25
|
-
this.checkForGaps();
|
|
26
25
|
this.audioQueue.resume();
|
|
27
26
|
});
|
|
28
27
|
});
|
|
@@ -40,26 +39,6 @@ class ContinuousPlayer extends events_1.default {
|
|
|
40
39
|
}
|
|
41
40
|
callback();
|
|
42
41
|
}
|
|
43
|
-
checkForGaps() {
|
|
44
|
-
if (this.sourceBuffer && this.sourceBuffer.buffered.length > 0) {
|
|
45
|
-
console.log(this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length - 1));
|
|
46
|
-
console;
|
|
47
|
-
}
|
|
48
|
-
if (this.sourceBuffer) {
|
|
49
|
-
for (let i = 0; i < this.sourceBuffer.buffered.length; i++) {
|
|
50
|
-
// Start and end times of the buffered range
|
|
51
|
-
let start = this.sourceBuffer.buffered.start(i);
|
|
52
|
-
let end = this.sourceBuffer.buffered.end(i);
|
|
53
|
-
// Check if there is a gap between the end of this range and the start of the next one
|
|
54
|
-
if (i < this.sourceBuffer.buffered.length - 1) {
|
|
55
|
-
let nextStart = this.sourceBuffer.buffered.start(i + 1);
|
|
56
|
-
if (end < nextStart) {
|
|
57
|
-
console.log(`Gap detected between ${end} and ${nextStart}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
42
|
clear() {
|
|
64
43
|
if (this.sourceBuffer) {
|
|
65
44
|
if (this.sourceBuffer.updating) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vapi-ai/web",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.77",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/vapi.js",
|
|
6
6
|
"types": "dist/vapi.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"build": "tsc && tsc --declaration",
|
|
10
10
|
"start": "npm run generate-api && npm run build && node dist/vapi.js",
|
|
11
|
-
"generate-api": "npx swagger-typescript-api -p https://api-tv2l.onrender.com/api-json -o . -n api.ts"
|
|
11
|
+
"generate-api": "npx swagger-typescript-api -p https://api-tv2l.onrender.com/api-json -o . -n api.ts",
|
|
12
|
+
"update": "./update.sh"
|
|
12
13
|
},
|
|
13
14
|
"repository": {
|
|
14
15
|
"type": "git",
|
package/player.ts
CHANGED
|
@@ -23,12 +23,11 @@ export class ContinuousPlayer extends EventEmitter {
|
|
|
23
23
|
this.mediaSource.addEventListener("sourceopen", () => {
|
|
24
24
|
this.mediaSource.duration = Number.POSITIVE_INFINITY;
|
|
25
25
|
this.sourceBuffer = this.mediaSource.addSourceBuffer(
|
|
26
|
-
'audio/
|
|
26
|
+
'audio/ogg; codecs="opus"'
|
|
27
27
|
);
|
|
28
28
|
this.sourceBuffer.mode = "sequence";
|
|
29
29
|
|
|
30
30
|
this.sourceBuffer.addEventListener("updateend", () => {
|
|
31
|
-
this.checkForGaps();
|
|
32
31
|
this.audioQueue.resume();
|
|
33
32
|
});
|
|
34
33
|
});
|
|
@@ -53,31 +52,6 @@ export class ContinuousPlayer extends EventEmitter {
|
|
|
53
52
|
callback();
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
private checkForGaps(): void {
|
|
57
|
-
if (this.sourceBuffer && this.sourceBuffer.buffered.length > 0) {
|
|
58
|
-
console.log(
|
|
59
|
-
this.sourceBuffer.buffered.end(this.sourceBuffer.buffered.length - 1)
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
console;
|
|
63
|
-
}
|
|
64
|
-
if (this.sourceBuffer) {
|
|
65
|
-
for (let i = 0; i < this.sourceBuffer.buffered.length; i++) {
|
|
66
|
-
// Start and end times of the buffered range
|
|
67
|
-
let start = this.sourceBuffer.buffered.start(i);
|
|
68
|
-
let end = this.sourceBuffer.buffered.end(i);
|
|
69
|
-
|
|
70
|
-
// Check if there is a gap between the end of this range and the start of the next one
|
|
71
|
-
if (i < this.sourceBuffer.buffered.length - 1) {
|
|
72
|
-
let nextStart = this.sourceBuffer.buffered.start(i + 1);
|
|
73
|
-
if (end < nextStart) {
|
|
74
|
-
console.log(`Gap detected between ${end} and ${nextStart}`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
55
|
clear(): void {
|
|
82
56
|
if (this.sourceBuffer) {
|
|
83
57
|
if (this.sourceBuffer.updating) {
|
package/update.sh
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm version patch && npm run build && npm publish && cd ../landing && npm install @vapi-ai/web@latest && cd -
|