@vapi-ai/web 1.0.121 → 1.0.123
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/AtomicMediaSource.ts +23 -7
- package/dist/AtomicMediaSource.js +8 -3
- package/package.json +1 -1
package/AtomicMediaSource.ts
CHANGED
|
@@ -19,13 +19,21 @@ class AtomicMediaSource {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
public appendBuffer(buffer: ArrayBuffer) {
|
|
22
|
+
console.log("APPEND OP PUSHED");
|
|
22
23
|
this.operationsQueue.push(() => {
|
|
24
|
+
console.log("APPEND OP START");
|
|
25
|
+
|
|
23
26
|
return new Promise((resolve, reject) => {
|
|
24
27
|
if (this.sourceBuffer) {
|
|
25
|
-
this.sourceBuffer.addEventListener(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
this.sourceBuffer.addEventListener(
|
|
29
|
+
"updateend",
|
|
30
|
+
() => {
|
|
31
|
+
console.log("APPEND OP END");
|
|
32
|
+
|
|
33
|
+
resolve();
|
|
34
|
+
},
|
|
35
|
+
{ once: true }
|
|
36
|
+
);
|
|
29
37
|
this.sourceBuffer.appendBuffer(buffer);
|
|
30
38
|
} else {
|
|
31
39
|
reject();
|
|
@@ -35,12 +43,20 @@ class AtomicMediaSource {
|
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
public clearBuffer() {
|
|
46
|
+
console.log("CLEAR OP PUSHED");
|
|
38
47
|
this.operationsQueue.push(() => {
|
|
48
|
+
console.log("CLEAR OP START");
|
|
49
|
+
|
|
39
50
|
return new Promise((resolve, reject) => {
|
|
40
51
|
if (this.sourceBuffer) {
|
|
41
|
-
this.sourceBuffer.addEventListener(
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
this.sourceBuffer.addEventListener(
|
|
53
|
+
"updateend",
|
|
54
|
+
() => {
|
|
55
|
+
console.log("CLEAR OP END");
|
|
56
|
+
resolve();
|
|
57
|
+
},
|
|
58
|
+
{ once: true }
|
|
59
|
+
);
|
|
44
60
|
this.sourceBuffer.remove(0, this.mediaSource.duration);
|
|
45
61
|
} else {
|
|
46
62
|
reject();
|
|
@@ -16,13 +16,15 @@ class AtomicMediaSource {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
appendBuffer(buffer) {
|
|
19
|
+
console.log("APPEND OP PUSHED");
|
|
19
20
|
this.operationsQueue.push(() => {
|
|
21
|
+
console.log("APPEND OP START");
|
|
20
22
|
return new Promise((resolve, reject) => {
|
|
21
23
|
if (this.sourceBuffer) {
|
|
22
24
|
this.sourceBuffer.addEventListener("updateend", () => {
|
|
25
|
+
console.log("APPEND OP END");
|
|
23
26
|
resolve();
|
|
24
|
-
});
|
|
25
|
-
console.log("APPEND");
|
|
27
|
+
}, { once: true });
|
|
26
28
|
this.sourceBuffer.appendBuffer(buffer);
|
|
27
29
|
}
|
|
28
30
|
else {
|
|
@@ -32,12 +34,15 @@ class AtomicMediaSource {
|
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
clearBuffer() {
|
|
37
|
+
console.log("CLEAR OP PUSHED");
|
|
35
38
|
this.operationsQueue.push(() => {
|
|
39
|
+
console.log("CLEAR OP START");
|
|
36
40
|
return new Promise((resolve, reject) => {
|
|
37
41
|
if (this.sourceBuffer) {
|
|
38
42
|
this.sourceBuffer.addEventListener("updateend", () => {
|
|
43
|
+
console.log("CLEAR OP END");
|
|
39
44
|
resolve();
|
|
40
|
-
});
|
|
45
|
+
}, { once: true });
|
|
41
46
|
this.sourceBuffer.remove(0, this.mediaSource.duration);
|
|
42
47
|
}
|
|
43
48
|
else {
|