@ikonai/sdk 0.0.31 → 0.0.33
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/assets/{audio-capture-worker-DINNsNmH.js → audio-capture-worker-CiEMOS9I.js} +323 -264
- package/assets/{audio-playback-worker-C4Eyhfrh.js → audio-playback-worker-WI7y4bo8.js} +351 -303
- package/client/ikon-client-config.d.ts +13 -5
- package/index.d.ts +1 -1
- package/index.js +1411 -1268
- package/media/audio-constants.d.ts +3 -0
- package/media/ikon-audio-capture.d.ts +4 -1
- package/media/ikon-audio-playback.d.ts +49 -28
- package/media/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
function
|
|
2
|
-
const s =
|
|
3
|
-
|
|
1
|
+
function F(e, t, r, n, i) {
|
|
2
|
+
const s = i?.trackId ?? 0, o = i?.sequenceId ?? 0, u = i?.flags ?? 0, c = i?.targetIds ?? [], w = i?.payloadType ?? 8, V = 27 + c.length * 4, R = V + t.length, B = new Uint8Array(R), d = new DataView(B.buffer);
|
|
3
|
+
d.setUint32(0, R, !0), d.setUint32(4, e >>> 0, !0), d.setUint32(8, n >>> 0, !0), d.setUint32(12, s >>> 0, !0), d.setUint32(16, o >>> 0, !0), d.setUint32(20, c.length >>> 0, !0), d.setUint8(24, r & 255), d.setUint8(25, w & 255), d.setUint8(26, u & 255);
|
|
4
4
|
let L = 27;
|
|
5
|
-
for (let
|
|
6
|
-
|
|
7
|
-
return
|
|
5
|
+
for (let D = 0; D < c.length; D++)
|
|
6
|
+
d.setUint32(L, c[D] >>> 0, !0), L += 4;
|
|
7
|
+
return B.set(t, V), B;
|
|
8
8
|
}
|
|
9
|
-
var
|
|
9
|
+
var y = /* @__PURE__ */ ((e) => (e[e.Null = 1] = "Null", e[e.Bool = 2] = "Bool", e[e.Int32 = 3] = "Int32", e[e.Int64 = 4] = "Int64", e[e.UInt32 = 5] = "UInt32", e[e.UInt64 = 6] = "UInt64", e[e.Float32 = 7] = "Float32", e[e.Float64 = 8] = "Float64", e[e.Array = 9] = "Array", e[e.Dict = 10] = "Dict", e[e.Object = 11] = "Object", e[e.String = 12] = "String", e[e.Binary = 13] = "Binary", e[e.Guid = 14] = "Guid", e))(y || {});
|
|
10
10
|
const C = 161, K = 162, E = new TextEncoder();
|
|
11
11
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
12
|
-
class
|
|
12
|
+
class f {
|
|
13
13
|
constructor(t = 1) {
|
|
14
14
|
this.version = t, this.buffer.writeByte(C), this.buffer.writeVarUInt(t >>> 0);
|
|
15
15
|
}
|
|
16
|
-
buffer = new
|
|
16
|
+
buffer = new I();
|
|
17
17
|
closed = !1;
|
|
18
18
|
cached;
|
|
19
19
|
writeInt32Field(t, r) {
|
|
@@ -38,54 +38,54 @@ class y {
|
|
|
38
38
|
this.writeFixedField(t, 2, () => this.buffer.writeByte(r ? 1 : 0));
|
|
39
39
|
}
|
|
40
40
|
writeGuidField(t, r) {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
41
|
+
const n = r instanceof a ? r.asBytes() : r;
|
|
42
|
+
if (n.length !== 16)
|
|
43
43
|
throw new Error("Guid payload must be 16 bytes");
|
|
44
|
-
this.writeFixedField(t, 14, () => this.buffer.writeBytes(
|
|
44
|
+
this.writeFixedField(t, 14, () => this.buffer.writeBytes(n));
|
|
45
45
|
}
|
|
46
46
|
writeStringField(t, r) {
|
|
47
|
-
const
|
|
48
|
-
this.writeVariableField(t, 12,
|
|
47
|
+
const n = E.encode(r ?? "");
|
|
48
|
+
this.writeVariableField(t, 12, n);
|
|
49
49
|
}
|
|
50
50
|
writeBinaryField(t, r) {
|
|
51
51
|
this.writeVariableField(t, 13, r);
|
|
52
52
|
}
|
|
53
|
-
writeObjectField(t, r,
|
|
54
|
-
const
|
|
55
|
-
i
|
|
56
|
-
const s =
|
|
53
|
+
writeObjectField(t, r, n) {
|
|
54
|
+
const i = new f(r);
|
|
55
|
+
n(i);
|
|
56
|
+
const s = i.finish();
|
|
57
57
|
this.writeVariableField(t, 11, s);
|
|
58
58
|
}
|
|
59
|
-
writeArrayField(t, r,
|
|
60
|
-
const
|
|
61
|
-
i
|
|
62
|
-
const s =
|
|
59
|
+
writeArrayField(t, r, n) {
|
|
60
|
+
const i = new b(r);
|
|
61
|
+
n(i);
|
|
62
|
+
const s = i.finish();
|
|
63
63
|
this.writeVariableField(t, 9, s);
|
|
64
64
|
}
|
|
65
|
-
writeDictionaryField(t, r,
|
|
66
|
-
const s = new
|
|
67
|
-
|
|
65
|
+
writeDictionaryField(t, r, n, i) {
|
|
66
|
+
const s = new S(r, n);
|
|
67
|
+
i(s);
|
|
68
68
|
const o = s.finish();
|
|
69
69
|
this.writeVariableField(t, 10, o);
|
|
70
70
|
}
|
|
71
71
|
finish() {
|
|
72
72
|
return this.closed || (this.buffer.writeByte(K), this.closed = !0, this.cached = this.buffer.toUint8Array()), this.cached;
|
|
73
73
|
}
|
|
74
|
-
writeFixedField(t, r,
|
|
75
|
-
this.writeFieldHeader(t, r, 0),
|
|
74
|
+
writeFixedField(t, r, n) {
|
|
75
|
+
this.writeFieldHeader(t, r, 0), n();
|
|
76
76
|
}
|
|
77
|
-
writeVariableField(t, r,
|
|
78
|
-
this.writeFieldHeader(t, r,
|
|
77
|
+
writeVariableField(t, r, n) {
|
|
78
|
+
this.writeFieldHeader(t, r, n.length), this.buffer.writeBytes(n);
|
|
79
79
|
}
|
|
80
|
-
writeFieldHeader(t, r,
|
|
81
|
-
this.buffer.writeUInt32(t >>> 0), this.buffer.writeByte(
|
|
80
|
+
writeFieldHeader(t, r, n) {
|
|
81
|
+
this.buffer.writeUInt32(t >>> 0), this.buffer.writeByte(U(r)), j(r) && this.buffer.writeVarUInt(n >>> 0);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
class b {
|
|
85
85
|
constructor(t) {
|
|
86
86
|
this.elementType = t;
|
|
87
87
|
}
|
|
88
|
-
payload = new
|
|
88
|
+
payload = new I();
|
|
89
89
|
count = 0;
|
|
90
90
|
writeInt32(t) {
|
|
91
91
|
this.ensureElementType(
|
|
@@ -158,45 +158,45 @@ class b {
|
|
|
158
158
|
11
|
|
159
159
|
/* Object */
|
|
160
160
|
), this.count++;
|
|
161
|
-
const
|
|
162
|
-
r(
|
|
163
|
-
const
|
|
164
|
-
this.payload.writeVarUInt(
|
|
161
|
+
const n = new f(t);
|
|
162
|
+
r(n);
|
|
163
|
+
const i = n.finish();
|
|
164
|
+
this.payload.writeVarUInt(i.length), this.payload.writeBytes(i);
|
|
165
165
|
}
|
|
166
166
|
writeArray(t, r) {
|
|
167
167
|
this.ensureElementType(
|
|
168
168
|
9
|
|
169
169
|
/* Array */
|
|
170
170
|
), this.count++;
|
|
171
|
-
const
|
|
172
|
-
r(
|
|
173
|
-
const
|
|
174
|
-
this.payload.writeBytes(
|
|
171
|
+
const n = new b(t);
|
|
172
|
+
r(n);
|
|
173
|
+
const i = n.finish();
|
|
174
|
+
this.payload.writeBytes(i);
|
|
175
175
|
}
|
|
176
|
-
writeDictionary(t, r,
|
|
176
|
+
writeDictionary(t, r, n) {
|
|
177
177
|
this.ensureElementType(
|
|
178
178
|
10
|
|
179
179
|
/* Dict */
|
|
180
180
|
), this.count++;
|
|
181
|
-
const
|
|
182
|
-
i
|
|
183
|
-
const s =
|
|
181
|
+
const i = new S(t, r);
|
|
182
|
+
n(i);
|
|
183
|
+
const s = i.finish();
|
|
184
184
|
this.payload.writeBytes(s);
|
|
185
185
|
}
|
|
186
186
|
finish() {
|
|
187
|
-
const t = new
|
|
188
|
-
return t.writeByte(
|
|
187
|
+
const t = new I();
|
|
188
|
+
return t.writeByte(U(this.elementType)), t.writeVarUInt(this.count), t.writeBytes(this.payload.toUint8Array()), t.toUint8Array();
|
|
189
189
|
}
|
|
190
190
|
ensureElementType(t) {
|
|
191
191
|
if (this.elementType !== t)
|
|
192
|
-
throw new Error(`Array element type is ${
|
|
192
|
+
throw new Error(`Array element type is ${y[this.elementType]}, expected ${y[t]}`);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
class
|
|
195
|
+
class S {
|
|
196
196
|
constructor(t, r) {
|
|
197
|
-
this.keyType = t, this.valueType = r,
|
|
197
|
+
this.keyType = t, this.valueType = r, z(t);
|
|
198
198
|
}
|
|
199
|
-
payload = new
|
|
199
|
+
payload = new I();
|
|
200
200
|
count = 0;
|
|
201
201
|
entryOpen = !1;
|
|
202
202
|
beginEntry() {
|
|
@@ -209,13 +209,13 @@ class _ {
|
|
|
209
209
|
finish() {
|
|
210
210
|
if (this.entryOpen)
|
|
211
211
|
throw new Error("Dictionary entry not completed");
|
|
212
|
-
const t = new
|
|
213
|
-
return t.writeByte(
|
|
212
|
+
const t = new I();
|
|
213
|
+
return t.writeByte(U(this.keyType)), t.writeByte(U(this.valueType)), t.writeVarUInt(this.count), t.writeBytes(this.payload.toUint8Array()), t.toUint8Array();
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
class H {
|
|
217
|
-
constructor(t, r,
|
|
218
|
-
this.keyType = t, this.valueType = r, this.payload =
|
|
217
|
+
constructor(t, r, n, i) {
|
|
218
|
+
this.keyType = t, this.valueType = r, this.payload = n, this.onComplete = i;
|
|
219
219
|
}
|
|
220
220
|
keyWritten = !1;
|
|
221
221
|
valueWritten = !1;
|
|
@@ -363,29 +363,29 @@ class H {
|
|
|
363
363
|
11
|
|
364
364
|
/* Object */
|
|
365
365
|
);
|
|
366
|
-
const
|
|
367
|
-
r(
|
|
368
|
-
const
|
|
369
|
-
this.payload.writeVarUInt(
|
|
366
|
+
const n = new f(t);
|
|
367
|
+
r(n);
|
|
368
|
+
const i = n.finish();
|
|
369
|
+
this.payload.writeVarUInt(i.length), this.payload.writeBytes(i), this.valueWritten = !0;
|
|
370
370
|
}
|
|
371
371
|
writeValueArray(t, r) {
|
|
372
372
|
this.ensureValueType(
|
|
373
373
|
9
|
|
374
374
|
/* Array */
|
|
375
375
|
);
|
|
376
|
-
const
|
|
377
|
-
r(
|
|
378
|
-
const
|
|
379
|
-
this.payload.writeBytes(
|
|
376
|
+
const n = new b(t);
|
|
377
|
+
r(n);
|
|
378
|
+
const i = n.finish();
|
|
379
|
+
this.payload.writeBytes(i), this.valueWritten = !0;
|
|
380
380
|
}
|
|
381
|
-
writeValueDictionary(t, r,
|
|
381
|
+
writeValueDictionary(t, r, n) {
|
|
382
382
|
this.ensureValueType(
|
|
383
383
|
10
|
|
384
384
|
/* Dict */
|
|
385
385
|
);
|
|
386
|
-
const
|
|
387
|
-
i
|
|
388
|
-
const s =
|
|
386
|
+
const i = new S(t, r);
|
|
387
|
+
n(i);
|
|
388
|
+
const s = i.finish();
|
|
389
389
|
this.payload.writeBytes(s), this.valueWritten = !0;
|
|
390
390
|
}
|
|
391
391
|
complete() {
|
|
@@ -397,11 +397,11 @@ class H {
|
|
|
397
397
|
}
|
|
398
398
|
ensureKeyType(t) {
|
|
399
399
|
if (this.keyType !== t)
|
|
400
|
-
throw new Error(`Dictionary key type is ${
|
|
400
|
+
throw new Error(`Dictionary key type is ${y[this.keyType]}, expected ${y[t]}`);
|
|
401
401
|
}
|
|
402
402
|
ensureValueType(t) {
|
|
403
403
|
if (this.valueType !== t)
|
|
404
|
-
throw new Error(`Dictionary value type is ${
|
|
404
|
+
throw new Error(`Dictionary value type is ${y[this.valueType]}, expected ${y[t]}`);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
class a {
|
|
@@ -414,11 +414,11 @@ class a {
|
|
|
414
414
|
const r = t.replace(/-/g, "");
|
|
415
415
|
if (r.length !== 32)
|
|
416
416
|
throw new Error("Guid string must be 32 hex characters");
|
|
417
|
-
const
|
|
418
|
-
a.writeUInt32LE(
|
|
419
|
-
for (let
|
|
420
|
-
|
|
421
|
-
return new a(
|
|
417
|
+
const n = new Uint8Array(16), i = a.parseHexSlice(r, 0, 8), s = a.parseHexSlice(r, 8, 4), o = a.parseHexSlice(r, 12, 4);
|
|
418
|
+
a.writeUInt32LE(n, 0, i), a.writeUInt16LE(n, 4, s), a.writeUInt16LE(n, 6, o);
|
|
419
|
+
for (let u = 0; u < 8; u++)
|
|
420
|
+
n[8 + u] = a.parseHexSlice(r, 16 + u * 2, 2);
|
|
421
|
+
return new a(n);
|
|
422
422
|
}
|
|
423
423
|
static fromBytes(t) {
|
|
424
424
|
if (t.length !== 16)
|
|
@@ -433,8 +433,8 @@ class a {
|
|
|
433
433
|
if (r?.getRandomValues)
|
|
434
434
|
r.getRandomValues(t);
|
|
435
435
|
else
|
|
436
|
-
for (let
|
|
437
|
-
t[
|
|
436
|
+
for (let n = 0; n < t.length; n++)
|
|
437
|
+
t[n] = Math.floor(Math.random() * 256);
|
|
438
438
|
return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, new a(t);
|
|
439
439
|
}
|
|
440
440
|
toString() {
|
|
@@ -443,26 +443,26 @@ class a {
|
|
|
443
443
|
a.toHex(a.readUInt32LE(t, 0), 8),
|
|
444
444
|
a.toHex(a.readUInt16LE(t, 4), 4),
|
|
445
445
|
a.toHex(a.readUInt16LE(t, 6), 4),
|
|
446
|
-
|
|
447
|
-
|
|
446
|
+
T(t.subarray(8, 10)),
|
|
447
|
+
T(t.subarray(10, 16))
|
|
448
448
|
].join("-");
|
|
449
449
|
}
|
|
450
450
|
asBytes() {
|
|
451
451
|
return this.bytes.slice();
|
|
452
452
|
}
|
|
453
|
-
static parseHexSlice(t, r,
|
|
454
|
-
const
|
|
453
|
+
static parseHexSlice(t, r, n) {
|
|
454
|
+
const i = t.substr(r, n), s = Number.parseInt(i, 16);
|
|
455
455
|
if (Number.isNaN(s))
|
|
456
456
|
throw new Error("Guid string contains invalid characters");
|
|
457
457
|
return s >>> 0;
|
|
458
458
|
}
|
|
459
|
-
static writeUInt32LE(t, r,
|
|
460
|
-
const
|
|
461
|
-
t[r] =
|
|
459
|
+
static writeUInt32LE(t, r, n) {
|
|
460
|
+
const i = n >>> 0;
|
|
461
|
+
t[r] = i & 255, t[r + 1] = i >>> 8 & 255, t[r + 2] = i >>> 16 & 255, t[r + 3] = i >>> 24 & 255;
|
|
462
462
|
}
|
|
463
|
-
static writeUInt16LE(t, r,
|
|
464
|
-
const
|
|
465
|
-
t[r] =
|
|
463
|
+
static writeUInt16LE(t, r, n) {
|
|
464
|
+
const i = n & 65535;
|
|
465
|
+
t[r] = i & 255, t[r + 1] = i >>> 8 & 255;
|
|
466
466
|
}
|
|
467
467
|
static readUInt32LE(t, r) {
|
|
468
468
|
return (t[r] | t[r + 1] << 8 | t[r + 2] << 16 | t[r + 3] << 24) >>> 0;
|
|
@@ -474,7 +474,7 @@ class a {
|
|
|
474
474
|
return (t >>> 0).toString(16).padStart(r, "0");
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
class
|
|
477
|
+
class I {
|
|
478
478
|
bytes = [];
|
|
479
479
|
writeByte(t) {
|
|
480
480
|
this.bytes.push(t & 255);
|
|
@@ -515,103 +515,103 @@ class p {
|
|
|
515
515
|
return Uint8Array.from(this.bytes);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function U(e, t = 0) {
|
|
519
519
|
if ((t & 240) !== 0)
|
|
520
520
|
throw new Error("Teleport flags must fit into 4 bits");
|
|
521
521
|
return (e & 15) << 4 | t & 15;
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function j(e) {
|
|
524
524
|
return e === 12 || e === 13 || e === 9 || e === 11 || e === 10;
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function z(e) {
|
|
527
527
|
if (e === 9 || e === 11 || e === 10 || e === 1)
|
|
528
528
|
throw new Error("Dictionary keys must be primitive Teleport types");
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function T(e) {
|
|
531
531
|
return Array.from(e).map((t) => t.toString(16).padStart(2, "0")).join("");
|
|
532
532
|
}
|
|
533
|
-
var
|
|
534
|
-
const
|
|
533
|
+
var _ = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Opus = 1] = "Opus", e[e.Mp3 = 2] = "Mp3", e[e.RawPcm16 = 3] = "RawPcm16", e))(_ || {});
|
|
534
|
+
const W = 1, $ = 4194307, q = 271275304, G = 668699606, Y = 945580544, J = 1594075008, Z = 2079085407, Q = 2541432218, X = 2986785889, tt = 3105403172, et = 4017217601;
|
|
535
535
|
function rt(e) {
|
|
536
536
|
const t = {};
|
|
537
|
-
return
|
|
537
|
+
return nt(t), e && Object.assign(t, e), t;
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function nt(e) {
|
|
540
540
|
return e.Data = new Uint8Array(0), e.IsKey = !1, e.IsLast = !1, e.TimestampInUs = 0n, e.DurationInUs = 0, e.IsFirst = !1, e.TotalDurationInUs = 0, e.Volume = 0, e.VolumeSampleCount = 0, e;
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
const t = new
|
|
542
|
+
function it(e) {
|
|
543
|
+
const t = new f(W);
|
|
544
544
|
return st(e, t), t.finish();
|
|
545
545
|
}
|
|
546
546
|
function st(e, t) {
|
|
547
|
-
t.writeUInt64Field(
|
|
547
|
+
t.writeUInt64Field(q, e.TimestampInUs), t.writeUInt32Field(G, e.TotalDurationInUs >>> 0), t.writeInt32Field(Y, e.VolumeSampleCount | 0), t.writeBoolField(J, e.IsFirst), t.writeFloat32Field(Z, e.Volume), t.writeUInt32Field(Q, e.DurationInUs >>> 0), t.writeBinaryField(X, e.Data), t.writeBoolField(tt, e.IsKey), t.writeBoolField(et, e.IsLast);
|
|
548
548
|
}
|
|
549
549
|
function at(e, t, r) {
|
|
550
|
-
const
|
|
551
|
-
return
|
|
550
|
+
const n = it(e);
|
|
551
|
+
return F($, n, W, t, r);
|
|
552
552
|
}
|
|
553
|
-
const
|
|
554
|
-
function
|
|
553
|
+
const P = 1, ot = 4194308, ut = 2079085407, ct = 3485914759;
|
|
554
|
+
function lt(e) {
|
|
555
555
|
const t = {};
|
|
556
|
-
return
|
|
556
|
+
return dt(t), e && Object.assign(t, e), t;
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function dt(e) {
|
|
559
559
|
return e.Volume = 0, e.Count = 0, e;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
562
|
-
const t = new
|
|
563
|
-
return
|
|
561
|
+
function ht(e) {
|
|
562
|
+
const t = new f(P);
|
|
563
|
+
return ft(e, t), t.finish();
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
t.writeFloat32Field(ut, e.Volume), t.writeInt32Field(
|
|
565
|
+
function ft(e, t) {
|
|
566
|
+
t.writeFloat32Field(ut, e.Volume), t.writeInt32Field(ct, e.Count | 0);
|
|
567
567
|
}
|
|
568
|
-
function
|
|
569
|
-
const
|
|
570
|
-
return
|
|
568
|
+
function yt(e, t, r) {
|
|
569
|
+
const n = ht(e);
|
|
570
|
+
return F(ot, n, P, t, r);
|
|
571
571
|
}
|
|
572
|
-
const k = 1,
|
|
572
|
+
const k = 1, wt = 4194305, pt = 1368629611, It = 2431514951, mt = 2914494629, gt = 3284746250, Et = 4101844078;
|
|
573
573
|
function Ut(e) {
|
|
574
574
|
const t = {};
|
|
575
|
-
return
|
|
575
|
+
return Ft(t), e && Object.assign(t, e), t;
|
|
576
576
|
}
|
|
577
|
-
function
|
|
578
|
-
return e.Description = "", e.Codec =
|
|
577
|
+
function Ft(e) {
|
|
578
|
+
return e.Description = "", e.Codec = _.Unknown, e.SampleRate = 0, e.Channels = 0, e.BitDepth = 0, e;
|
|
579
579
|
}
|
|
580
|
-
function
|
|
581
|
-
const t = new
|
|
582
|
-
return
|
|
580
|
+
function bt(e) {
|
|
581
|
+
const t = new f(k);
|
|
582
|
+
return At(e, t), t.finish();
|
|
583
583
|
}
|
|
584
|
-
function
|
|
585
|
-
t.writeStringField(pt, e.Description), t.writeInt32Field(It, e.Channels | 0), t.writeInt32Field(mt, e.BitDepth | 0), t.writeInt32Field(
|
|
584
|
+
function At(e, t) {
|
|
585
|
+
t.writeStringField(pt, e.Description), t.writeInt32Field(It, e.Channels | 0), t.writeInt32Field(mt, e.BitDepth | 0), t.writeInt32Field(gt, e.Codec), t.writeInt32Field(Et, e.SampleRate | 0);
|
|
586
586
|
}
|
|
587
|
-
function
|
|
588
|
-
const
|
|
589
|
-
return
|
|
587
|
+
function Bt(e, t, r) {
|
|
588
|
+
const n = bt(e);
|
|
589
|
+
return F(wt, n, k, t, r);
|
|
590
590
|
}
|
|
591
|
-
const
|
|
592
|
-
function
|
|
591
|
+
const N = 1, Dt = 4194306;
|
|
592
|
+
function St(e) {
|
|
593
593
|
const t = {};
|
|
594
594
|
return e && Object.assign(t, e), t;
|
|
595
595
|
}
|
|
596
|
-
function
|
|
597
|
-
return new
|
|
596
|
+
function _t(e) {
|
|
597
|
+
return new f(N).finish();
|
|
598
598
|
}
|
|
599
|
-
function
|
|
600
|
-
const
|
|
601
|
-
return
|
|
599
|
+
function Ot(e, t, r) {
|
|
600
|
+
const n = _t();
|
|
601
|
+
return F(Dt, n, N, t, r);
|
|
602
602
|
}
|
|
603
|
-
class
|
|
603
|
+
class Mt {
|
|
604
604
|
static getStorageForCapacity(t, r) {
|
|
605
|
-
const
|
|
606
|
-
return new SharedArrayBuffer(
|
|
605
|
+
const n = Int32Array.BYTES_PER_ELEMENT * 2, i = r.BYTES_PER_ELEMENT * t;
|
|
606
|
+
return new SharedArrayBuffer(n + i);
|
|
607
607
|
}
|
|
608
608
|
readWrite;
|
|
609
609
|
storage;
|
|
610
610
|
buf;
|
|
611
611
|
constructor(t, r) {
|
|
612
612
|
this.buf = t, this.readWrite = new Int32Array(t, 0, 2);
|
|
613
|
-
const
|
|
614
|
-
this.storage = new r(t,
|
|
613
|
+
const n = Int32Array.BYTES_PER_ELEMENT * 2, i = (t.byteLength - n) / Float32Array.BYTES_PER_ELEMENT;
|
|
614
|
+
this.storage = new r(t, n, i);
|
|
615
615
|
}
|
|
616
616
|
get capacity() {
|
|
617
617
|
return this.storage.length;
|
|
@@ -630,85 +630,85 @@ class Vt {
|
|
|
630
630
|
const r = Math.min(this.availableWrite(), t.length);
|
|
631
631
|
if (r <= 0)
|
|
632
632
|
return 0;
|
|
633
|
-
let
|
|
634
|
-
const
|
|
635
|
-
this.storage.set(t.subarray(0,
|
|
636
|
-
const s = r -
|
|
637
|
-
return s > 0 && this.storage.set(t.subarray(
|
|
633
|
+
let n = Atomics.load(this.readWrite, 1);
|
|
634
|
+
const i = Math.min(r, this.capacity - n);
|
|
635
|
+
this.storage.set(t.subarray(0, i), n);
|
|
636
|
+
const s = r - i;
|
|
637
|
+
return s > 0 && this.storage.set(t.subarray(i, i + s), 0), n = (n + r) % this.capacity, Atomics.store(this.readWrite, 1, n), Atomics.notify(this.readWrite, 1), r;
|
|
638
638
|
}
|
|
639
639
|
pop(t) {
|
|
640
640
|
const r = Math.min(this.availableRead(), t.length);
|
|
641
641
|
if (r <= 0)
|
|
642
642
|
return 0;
|
|
643
|
-
let
|
|
644
|
-
const
|
|
645
|
-
t.set(this.storage.subarray(
|
|
646
|
-
const s = r -
|
|
647
|
-
return s > 0 && t.set(this.storage.subarray(0, s),
|
|
643
|
+
let n = Atomics.load(this.readWrite, 0);
|
|
644
|
+
const i = Math.min(r, this.capacity - n);
|
|
645
|
+
t.set(this.storage.subarray(n, n + i), 0);
|
|
646
|
+
const s = r - i;
|
|
647
|
+
return s > 0 && t.set(this.storage.subarray(0, s), i), n = (n + r) % this.capacity, Atomics.store(this.readWrite, 0, n), r;
|
|
648
648
|
}
|
|
649
649
|
skip(t) {
|
|
650
650
|
const r = Math.min(this.availableRead(), t);
|
|
651
651
|
if (r <= 0)
|
|
652
652
|
return 0;
|
|
653
|
-
let
|
|
654
|
-
return
|
|
653
|
+
let n = Atomics.load(this.readWrite, 0);
|
|
654
|
+
return n = (n + r) % this.capacity, Atomics.store(this.readWrite, 0, n), r;
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
|
-
let
|
|
658
|
-
function
|
|
657
|
+
let Vt = 1;
|
|
658
|
+
function Rt(e, t) {
|
|
659
659
|
return `[${e}] ${t}`;
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
if ((/* @__PURE__ */ new Date()).toISOString(),
|
|
663
|
-
const
|
|
661
|
+
function g(e, t, r, n) {
|
|
662
|
+
if ((/* @__PURE__ */ new Date()).toISOString(), Vt <= e) {
|
|
663
|
+
const i = Rt(t, r);
|
|
664
664
|
switch (e) {
|
|
665
665
|
case 0:
|
|
666
|
-
console.debug(
|
|
666
|
+
console.debug(i, ...n);
|
|
667
667
|
break;
|
|
668
668
|
case 1:
|
|
669
|
-
console.info(
|
|
669
|
+
console.info(i, ...n);
|
|
670
670
|
break;
|
|
671
671
|
case 2:
|
|
672
|
-
console.warn(
|
|
672
|
+
console.warn(i, ...n);
|
|
673
673
|
break;
|
|
674
674
|
case 3:
|
|
675
|
-
console.error(
|
|
675
|
+
console.error(i, ...n);
|
|
676
676
|
break;
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function Lt(e) {
|
|
681
681
|
return {
|
|
682
682
|
debug(t, ...r) {
|
|
683
|
-
|
|
683
|
+
g(0, e, t, r);
|
|
684
684
|
},
|
|
685
685
|
info(t, ...r) {
|
|
686
|
-
|
|
686
|
+
g(1, e, t, r);
|
|
687
687
|
},
|
|
688
688
|
warn(t, ...r) {
|
|
689
|
-
|
|
689
|
+
g(2, e, t, r);
|
|
690
690
|
},
|
|
691
691
|
error(t, ...r) {
|
|
692
|
-
|
|
692
|
+
g(3, e, t, r);
|
|
693
693
|
}
|
|
694
694
|
};
|
|
695
695
|
}
|
|
696
|
-
const Tt =
|
|
697
|
-
let
|
|
698
|
-
function
|
|
696
|
+
const Tt = 20, Wt = 32e3, Pt = Lt("AudioCaptureWorker"), O = (e) => self.postMessage(e);
|
|
697
|
+
let h = null;
|
|
698
|
+
function m(e, t) {
|
|
699
699
|
const r = e instanceof Error ? e : new Error(String(e));
|
|
700
|
-
|
|
700
|
+
O({ type: "error", captureId: t, error: { name: r.name, message: r.message, stack: r.stack } });
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function kt(e) {
|
|
703
703
|
return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength ? e.buffer : e.slice().buffer;
|
|
704
704
|
}
|
|
705
705
|
function A(e) {
|
|
706
|
-
if (!
|
|
706
|
+
if (!h)
|
|
707
707
|
return;
|
|
708
|
-
const t =
|
|
709
|
-
|
|
708
|
+
const t = kt(e);
|
|
709
|
+
h.postMessage({ type: "send", message: t }, [t]);
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function Nt(e) {
|
|
712
712
|
if (e.length === 0)
|
|
713
713
|
return 0;
|
|
714
714
|
let t = 0;
|
|
@@ -716,90 +716,126 @@ function kt(e) {
|
|
|
716
716
|
t += Math.abs(e[r] ?? 0);
|
|
717
717
|
return t / e.length;
|
|
718
718
|
}
|
|
719
|
-
const
|
|
720
|
-
let
|
|
719
|
+
const l = /* @__PURE__ */ new Map();
|
|
720
|
+
let p = null;
|
|
721
721
|
function vt() {
|
|
722
|
-
|
|
723
|
-
for (const e of
|
|
722
|
+
p === null && (p = self.setInterval(() => {
|
|
723
|
+
for (const e of l.values())
|
|
724
724
|
if (!(e.transport !== "sab" || !e.ringBuffer || !e.ringTemp || e.stopped))
|
|
725
725
|
try {
|
|
726
726
|
const t = e.ringBuffer.pop(e.ringTemp);
|
|
727
727
|
if (t <= 0)
|
|
728
728
|
continue;
|
|
729
|
-
|
|
730
|
-
x(e, new Float32Array(r));
|
|
729
|
+
v(e, e.ringTemp.subarray(0, t));
|
|
731
730
|
} catch (t) {
|
|
732
|
-
|
|
731
|
+
m(t, e.captureId);
|
|
733
732
|
}
|
|
734
733
|
}, 10));
|
|
735
734
|
}
|
|
736
|
-
function
|
|
737
|
-
if (
|
|
735
|
+
function xt() {
|
|
736
|
+
if (p === null)
|
|
737
|
+
return;
|
|
738
|
+
let e = !1;
|
|
739
|
+
for (const t of l.values())
|
|
740
|
+
if (t.transport === "sab" && !t.stopped) {
|
|
741
|
+
e = !0;
|
|
742
|
+
break;
|
|
743
|
+
}
|
|
744
|
+
if (!e) {
|
|
738
745
|
try {
|
|
739
|
-
self.clearInterval(
|
|
746
|
+
self.clearInterval(p);
|
|
740
747
|
} catch {
|
|
741
748
|
}
|
|
742
|
-
|
|
749
|
+
p = null;
|
|
743
750
|
}
|
|
744
751
|
}
|
|
745
|
-
function
|
|
746
|
-
if (
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
752
|
+
function M(e) {
|
|
753
|
+
if (e.stopped)
|
|
754
|
+
return;
|
|
755
|
+
if (!e.inSegment) {
|
|
756
|
+
e.pendingReadOffset = 0, e.pendingWriteOffset = 0, e.pendingSamples = 0;
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
const t = e.frameSize, r = e.frameBuffer, n = e.pendingBuffer.length;
|
|
760
|
+
for (; e.pendingSamples >= t; ) {
|
|
761
|
+
const i = e.pendingReadOffset;
|
|
762
|
+
if (i + t <= n)
|
|
763
|
+
r.set(e.pendingBuffer.subarray(i, i + t));
|
|
764
|
+
else {
|
|
765
|
+
const o = n - i;
|
|
766
|
+
r.set(e.pendingBuffer.subarray(i, n)), r.set(e.pendingBuffer.subarray(0, t - o), o);
|
|
767
|
+
}
|
|
768
|
+
e.pendingReadOffset = (i + t) % n, e.pendingSamples -= t;
|
|
769
|
+
const s = Nt(r);
|
|
770
|
+
A(yt(lt({ Volume: s, Count: t }), e.senderId, { trackId: e.trackId }));
|
|
771
|
+
try {
|
|
772
|
+
const o = new AudioData({
|
|
773
|
+
format: "f32",
|
|
774
|
+
sampleRate: e.sampleRate,
|
|
775
|
+
numberOfFrames: t,
|
|
776
|
+
numberOfChannels: e.channels,
|
|
777
|
+
timestamp: e.timestampUs,
|
|
778
|
+
data: r.buffer
|
|
779
|
+
});
|
|
780
|
+
e.encoder.encode(o), o.close();
|
|
781
|
+
} catch (o) {
|
|
782
|
+
m(o, e.captureId);
|
|
771
783
|
}
|
|
784
|
+
e.timestampUs += e.frameDurationUs;
|
|
785
|
+
}
|
|
772
786
|
}
|
|
773
|
-
function
|
|
774
|
-
|
|
787
|
+
function v(e, t) {
|
|
788
|
+
if (e.stopped)
|
|
789
|
+
return;
|
|
790
|
+
const r = t.length;
|
|
791
|
+
if (r === 0)
|
|
792
|
+
return;
|
|
793
|
+
const n = e.pendingSamples + r;
|
|
794
|
+
if (n > e.pendingBuffer.length) {
|
|
795
|
+
const o = Math.max(n, e.pendingBuffer.length * 2), u = new Float32Array(o);
|
|
796
|
+
if (e.pendingSamples > 0) {
|
|
797
|
+
const c = e.pendingBuffer.length;
|
|
798
|
+
if (e.pendingReadOffset + e.pendingSamples <= c)
|
|
799
|
+
u.set(e.pendingBuffer.subarray(e.pendingReadOffset, e.pendingReadOffset + e.pendingSamples));
|
|
800
|
+
else {
|
|
801
|
+
const w = c - e.pendingReadOffset;
|
|
802
|
+
u.set(e.pendingBuffer.subarray(e.pendingReadOffset, c)), u.set(e.pendingBuffer.subarray(0, e.pendingSamples - w), w);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
e.pendingBuffer = u, e.pendingReadOffset = 0, e.pendingWriteOffset = e.pendingSamples;
|
|
806
|
+
}
|
|
807
|
+
const i = e.pendingBuffer.length, s = Math.min(r, i - e.pendingWriteOffset);
|
|
808
|
+
e.pendingBuffer.set(t.subarray(0, s), e.pendingWriteOffset), s < r && e.pendingBuffer.set(t.subarray(s), 0), e.pendingWriteOffset = (e.pendingWriteOffset + r) % i, e.pendingSamples += r, M(e);
|
|
775
809
|
}
|
|
776
|
-
function
|
|
777
|
-
const t = Math.max(8e3, Math.floor(e.options?.bitrate ??
|
|
778
|
-
output: (
|
|
779
|
-
const
|
|
780
|
-
if (!
|
|
810
|
+
function Ct(e) {
|
|
811
|
+
const t = Math.max(8e3, Math.floor(e.options?.bitrate ?? Wt)), r = new AudioEncoder({
|
|
812
|
+
output: (n) => {
|
|
813
|
+
const i = l.get(e.captureId);
|
|
814
|
+
if (!i || i.stopped || !i.inSegment && !i.segmentEndPending)
|
|
781
815
|
return;
|
|
782
|
-
const s =
|
|
783
|
-
i.
|
|
784
|
-
const o =
|
|
785
|
-
|
|
816
|
+
const s = n.byteLength;
|
|
817
|
+
i.encoderOutputBuffer.length < s && (i.encoderOutputBuffer = new Uint8Array(Math.max(s, i.encoderOutputBuffer.length * 2))), n.copyTo(i.encoderOutputBuffer);
|
|
818
|
+
const o = i.encoderOutputBuffer.subarray(0, s), u = i.segmentStartPending;
|
|
819
|
+
u && (i.segmentStartPending = !1);
|
|
820
|
+
const c = i.segmentEndPending;
|
|
821
|
+
c && (i.segmentEndPending = !1, i.inSegment = !1), A(
|
|
786
822
|
at(
|
|
787
823
|
rt({
|
|
788
|
-
Data:
|
|
789
|
-
IsKey:
|
|
790
|
-
IsFirst:
|
|
791
|
-
IsLast:
|
|
792
|
-
TimestampInUs: BigInt(Math.max(0, Math.round(
|
|
793
|
-
DurationInUs: Math.max(0, Math.round(
|
|
824
|
+
Data: o,
|
|
825
|
+
IsKey: n.type === "key",
|
|
826
|
+
IsFirst: u,
|
|
827
|
+
IsLast: c,
|
|
828
|
+
TimestampInUs: BigInt(Math.max(0, Math.round(n.timestamp ?? i.timestampUs))),
|
|
829
|
+
DurationInUs: Math.max(0, Math.round(n.duration ?? i.frameDurationUs)),
|
|
794
830
|
TotalDurationInUs: 0
|
|
795
831
|
}),
|
|
796
|
-
|
|
797
|
-
{ trackId:
|
|
832
|
+
i.senderId,
|
|
833
|
+
{ trackId: i.trackId }
|
|
798
834
|
)
|
|
799
835
|
);
|
|
800
836
|
},
|
|
801
|
-
error: (
|
|
802
|
-
|
|
837
|
+
error: (n) => {
|
|
838
|
+
m(n, e.captureId);
|
|
803
839
|
}
|
|
804
840
|
});
|
|
805
841
|
return r.configure({
|
|
@@ -815,45 +851,52 @@ function xt(e) {
|
|
|
815
851
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
816
852
|
}), r;
|
|
817
853
|
}
|
|
818
|
-
function
|
|
819
|
-
if (!
|
|
854
|
+
function Kt(e) {
|
|
855
|
+
if (!h)
|
|
820
856
|
throw new Error("Audio capture worker missing send port");
|
|
821
|
-
if (
|
|
857
|
+
if (l.has(e.captureId))
|
|
822
858
|
return;
|
|
823
859
|
if (typeof AudioEncoder > "u")
|
|
824
860
|
throw new Error("AudioEncoder is not available in this browser");
|
|
825
|
-
const t = Math.max(8e3, Math.floor(e.sampleRate)), r = Math.max(1, Math.floor(e.channels)),
|
|
861
|
+
const t = Math.max(8e3, Math.floor(e.sampleRate)), r = Math.max(1, Math.floor(e.channels)), n = Math.max(1, Math.floor(t * Tt / 1e3)), i = Math.max(1, Math.floor(n * 1e6 / t)), s = n * 4, o = {
|
|
826
862
|
captureId: e.captureId,
|
|
827
863
|
senderId: e.senderId,
|
|
828
864
|
trackId: e.trackId,
|
|
829
865
|
sampleRate: t,
|
|
830
866
|
channels: r,
|
|
831
867
|
frameSize: n,
|
|
832
|
-
frameDurationUs:
|
|
868
|
+
frameDurationUs: i,
|
|
833
869
|
timestampUs: 0,
|
|
834
870
|
sentFirst: !1,
|
|
835
871
|
stopped: !1,
|
|
836
872
|
transport: e.transport,
|
|
837
873
|
ringBuffer: null,
|
|
838
874
|
ringTemp: null,
|
|
839
|
-
|
|
875
|
+
pendingBuffer: new Float32Array(s),
|
|
876
|
+
pendingReadOffset: 0,
|
|
877
|
+
pendingWriteOffset: 0,
|
|
840
878
|
pendingSamples: 0,
|
|
879
|
+
frameBuffer: new Float32Array(n),
|
|
880
|
+
encoderOutputBuffer: new Uint8Array(1024),
|
|
881
|
+
inSegment: !1,
|
|
882
|
+
segmentStartPending: !1,
|
|
883
|
+
segmentEndPending: !1,
|
|
841
884
|
options: e.options
|
|
842
|
-
},
|
|
885
|
+
}, u = Ct(o), c = {
|
|
843
886
|
...o,
|
|
844
|
-
encoder:
|
|
887
|
+
encoder: u
|
|
845
888
|
};
|
|
846
889
|
if (e.transport === "sab") {
|
|
847
890
|
if (!e.sharedArrayBuffer)
|
|
848
891
|
throw new Error("Missing SharedArrayBuffer for sab transport");
|
|
849
|
-
const
|
|
850
|
-
c.ringBuffer =
|
|
892
|
+
const w = new Mt(e.sharedArrayBuffer, Float32Array);
|
|
893
|
+
c.ringBuffer = w, c.ringTemp = new Float32Array(Math.max(c.frameSize * 4, 4096)), vt();
|
|
851
894
|
}
|
|
852
|
-
|
|
853
|
-
|
|
895
|
+
l.set(e.captureId, c), A(
|
|
896
|
+
Bt(
|
|
854
897
|
Ut({
|
|
855
898
|
Description: `mic:${e.captureId}`,
|
|
856
|
-
Codec:
|
|
899
|
+
Codec: _.Opus,
|
|
857
900
|
SampleRate: t,
|
|
858
901
|
Channels: r,
|
|
859
902
|
BitDepth: 32
|
|
@@ -861,14 +904,14 @@ function Pt(e) {
|
|
|
861
904
|
e.senderId,
|
|
862
905
|
{ trackId: e.trackId }
|
|
863
906
|
)
|
|
864
|
-
),
|
|
907
|
+
), O({ type: "started", captureId: e.captureId, sampleRate: t, channels: r });
|
|
865
908
|
}
|
|
866
|
-
async function
|
|
867
|
-
const t =
|
|
909
|
+
async function x(e) {
|
|
910
|
+
const t = l.get(e);
|
|
868
911
|
if (t) {
|
|
869
|
-
t.stopped = !0,
|
|
912
|
+
t.stopped = !0, l.delete(e);
|
|
870
913
|
try {
|
|
871
|
-
|
|
914
|
+
M(t);
|
|
872
915
|
} catch {
|
|
873
916
|
}
|
|
874
917
|
try {
|
|
@@ -879,55 +922,71 @@ async function P(e) {
|
|
|
879
922
|
t.encoder.close();
|
|
880
923
|
} catch {
|
|
881
924
|
}
|
|
882
|
-
A(
|
|
925
|
+
A(Ot(St({}), t.senderId, { trackId: t.trackId })), O({ type: "stopped", captureId: e }), xt();
|
|
883
926
|
}
|
|
884
927
|
}
|
|
885
|
-
function
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
928
|
+
function Ht(e) {
|
|
929
|
+
const t = l.get(e);
|
|
930
|
+
!t || t.stopped || (t.inSegment = !0, t.segmentStartPending = !0);
|
|
931
|
+
}
|
|
932
|
+
function jt(e) {
|
|
933
|
+
const t = l.get(e);
|
|
934
|
+
!t || t.stopped || !t.inSegment || (t.segmentEndPending = !0, M(t));
|
|
935
|
+
}
|
|
936
|
+
function zt() {
|
|
937
|
+
for (const e of Array.from(l.keys()))
|
|
938
|
+
x(e);
|
|
939
|
+
if (h) {
|
|
889
940
|
try {
|
|
890
|
-
|
|
941
|
+
h.close();
|
|
891
942
|
} catch {
|
|
892
943
|
}
|
|
893
|
-
|
|
944
|
+
h = null;
|
|
894
945
|
}
|
|
895
946
|
}
|
|
896
947
|
self.addEventListener("message", (e) => {
|
|
897
948
|
const t = e.data;
|
|
898
949
|
if (t.type === "attachSendPort") {
|
|
899
|
-
if (
|
|
950
|
+
if (h)
|
|
900
951
|
try {
|
|
901
|
-
|
|
952
|
+
h.close();
|
|
902
953
|
} catch {
|
|
903
954
|
}
|
|
904
|
-
|
|
955
|
+
h = t.port;
|
|
905
956
|
try {
|
|
906
|
-
|
|
957
|
+
h.start?.();
|
|
907
958
|
} catch {
|
|
908
959
|
}
|
|
909
960
|
return;
|
|
910
961
|
}
|
|
911
962
|
if (t.type === "start") {
|
|
912
963
|
try {
|
|
913
|
-
|
|
964
|
+
Kt(t);
|
|
914
965
|
} catch (r) {
|
|
915
|
-
|
|
966
|
+
m(r, t.captureId);
|
|
916
967
|
}
|
|
917
968
|
return;
|
|
918
969
|
}
|
|
919
970
|
if (t.type === "pcm") {
|
|
920
|
-
const r =
|
|
971
|
+
const r = l.get(t.captureId);
|
|
921
972
|
if (!r || r.stopped)
|
|
922
973
|
return;
|
|
923
|
-
|
|
974
|
+
v(r, t.pcm);
|
|
924
975
|
return;
|
|
925
976
|
}
|
|
926
977
|
if (t.type === "stop") {
|
|
927
|
-
|
|
928
|
-
|
|
978
|
+
x(t.captureId).catch((r) => {
|
|
979
|
+
Pt.warn(`Failed to stop audio capture: ${r}`), m(r, t.captureId);
|
|
929
980
|
});
|
|
930
981
|
return;
|
|
931
982
|
}
|
|
932
|
-
t.type === "
|
|
983
|
+
if (t.type === "startSegment") {
|
|
984
|
+
Ht(t.captureId);
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
if (t.type === "endSegment") {
|
|
988
|
+
jt(t.captureId);
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
t.type === "dispose" && zt();
|
|
933
992
|
});
|