@ikonai/sdk 1.0.79 → 1.1.0
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/app-messaging.d.ts +1 -1
- package/assets/audio-capture-worker-D-0X2Dy8.js +1 -0
- package/assets/audio-playback-worker-DivBZPfS.js +1 -0
- package/assets/libopus-CnBCihDi.js +1 -0
- package/assets/protocol-worker-BH93CVck.js +1 -0
- package/assets/src-BKYD07QQ.js +1 -0
- package/assets/src-DOUWsCWT.js +1 -0
- package/assets/video-capture-worker-BQGOFbZt.js +1 -0
- package/assets/video-playback-worker-tC5nUVnw.js +1 -0
- package/assets/viseme-worker-Cd-JqTVM.js +1 -0
- package/capabilities-BtJblfdG.js +108 -0
- package/channel/channel-manager.d.ts +1 -1
- package/channel/channel.d.ts +1 -1
- package/client/endpoint-selector.d.ts +1 -1
- package/client/ikon-client-config.d.ts +13 -11
- package/client/ikon-client.d.ts +98 -4
- package/connection/authenticator.d.ts +3 -3
- package/connection/urls.d.ts +7 -18
- package/errors/index.d.ts +22 -13
- package/functions/browser-functions.d.ts +1 -1
- package/functions/function-registry.d.ts +1 -1
- package/functions/types.d.ts +2 -2
- package/ikon-media-zqob_QeE.js +3160 -0
- package/index.d.ts +8 -8
- package/index.js +8119 -12502
- package/media/ikon-audio-capture.d.ts +15 -3
- package/media/ikon-audio-playback.d.ts +37 -0
- package/media/ikon-video-playback.d.ts +24 -0
- package/media/media-session-helper.d.ts +8 -0
- package/media/video-constants.d.ts +11 -1
- package/media/viseme-tracker.d.ts +10 -1
- package/package.json +1 -1
- package/storage.d.ts +13 -0
- package/transport/transport.d.ts +1 -1
- package/transport/web-socket-transport.d.ts +1 -1
- package/transport/web-transport-transport.d.ts +1 -1
- package/utils/inspect-mode.d.ts +4 -0
- package/utils/log-sender.d.ts +1 -1
- package/utils/platform.d.ts +4 -0
- package/utils/query-params.d.ts +8 -4
- package/vite.config.d.ts +2 -0
- package/webrtc/webrtc-signaling.d.ts +11 -2
- package/worker/audio-playback-worker.d.ts +14 -1
- package/worker/video-capture-worker.d.ts +2 -2
- package/worker/video-playback-worker.d.ts +14 -2
- package/worker/viseme-worker.d.ts +10 -2
- package/assets/audio-capture-worker-Brmt2Z7a.js +0 -1279
- package/assets/audio-playback-worker-DDtsnLoq.js +0 -1473
- package/assets/index-Ca9sTcGt.js +0 -119
- package/assets/index-D_vz6N3U.js +0 -267
- package/assets/libopus-ChbDZJKA.js +0 -139
- package/assets/protocol-worker-BoZcMF0x.js +0 -1674
- package/assets/video-capture-worker-DxgvFTcw.js +0 -1126
- package/assets/video-playback-worker-Ca4XVGqt.js +0 -1005
- package/assets/viseme-worker-DVWM4pRh.js +0 -831
|
@@ -1,1279 +0,0 @@
|
|
|
1
|
-
function L(t, e, r, n, i) {
|
|
2
|
-
const s = i?.trackId ?? 0, a = i?.sequenceId ?? 0, c = i?.flags ?? 0, d = i?.targetIds ?? [], o = i?.payloadType ?? 8, h = 27 + d.length * 4, y = h + e.length, u = new Uint8Array(y), f = new DataView(u.buffer);
|
|
3
|
-
f.setUint32(0, y, !0), f.setUint32(4, t >>> 0, !0), f.setUint32(8, n >>> 0, !0), f.setUint32(12, s >>> 0, !0), f.setUint32(16, a >>> 0, !0), f.setUint32(20, d.length >>> 0, !0), f.setUint8(24, r & 255), f.setUint8(25, o & 255), f.setUint8(26, c & 255);
|
|
4
|
-
let N = 27;
|
|
5
|
-
for (let V = 0; V < d.length; V++)
|
|
6
|
-
f.setUint32(N, d[V] >>> 0, !0), N += 4;
|
|
7
|
-
return u.set(e, h), u;
|
|
8
|
-
}
|
|
9
|
-
var m = /* @__PURE__ */ ((t) => (t[t.Null = 1] = "Null", t[t.Bool = 2] = "Bool", t[t.Int32 = 3] = "Int32", t[t.Int64 = 4] = "Int64", t[t.UInt32 = 5] = "UInt32", t[t.UInt64 = 6] = "UInt64", t[t.Float32 = 7] = "Float32", t[t.Float64 = 8] = "Float64", t[t.Array = 9] = "Array", t[t.Dict = 10] = "Dict", t[t.Object = 11] = "Object", t[t.String = 12] = "String", t[t.Binary = 13] = "Binary", t[t.Guid = 14] = "Guid", t))(m || {});
|
|
10
|
-
const q = 161, G = 162, _ = new TextEncoder();
|
|
11
|
-
new TextDecoder("utf-8", { fatal: !0 });
|
|
12
|
-
class S {
|
|
13
|
-
constructor(e = 1) {
|
|
14
|
-
this.version = e, this.buffer.writeByte(q), this.buffer.writeVarUInt(e >>> 0);
|
|
15
|
-
}
|
|
16
|
-
buffer = new E();
|
|
17
|
-
closed = !1;
|
|
18
|
-
cached;
|
|
19
|
-
writeInt32Field(e, r) {
|
|
20
|
-
this.writeFixedField(e, 3, () => this.buffer.writeInt32(r | 0));
|
|
21
|
-
}
|
|
22
|
-
writeUInt32Field(e, r) {
|
|
23
|
-
this.writeFixedField(e, 5, () => this.buffer.writeUInt32(r >>> 0));
|
|
24
|
-
}
|
|
25
|
-
writeInt64Field(e, r) {
|
|
26
|
-
this.writeFixedField(e, 4, () => this.buffer.writeBigInt64(r));
|
|
27
|
-
}
|
|
28
|
-
writeUInt64Field(e, r) {
|
|
29
|
-
this.writeFixedField(e, 6, () => this.buffer.writeBigUInt64(r));
|
|
30
|
-
}
|
|
31
|
-
writeFloat32Field(e, r) {
|
|
32
|
-
this.writeFixedField(e, 7, () => this.buffer.writeFloat32(r));
|
|
33
|
-
}
|
|
34
|
-
writeFloat64Field(e, r) {
|
|
35
|
-
this.writeFixedField(e, 8, () => this.buffer.writeFloat64(r));
|
|
36
|
-
}
|
|
37
|
-
writeBoolField(e, r) {
|
|
38
|
-
this.writeFixedField(e, 2, () => this.buffer.writeByte(r ? 1 : 0));
|
|
39
|
-
}
|
|
40
|
-
writeGuidField(e, r) {
|
|
41
|
-
const n = r instanceof l ? r.asBytes() : r;
|
|
42
|
-
if (n.length !== 16)
|
|
43
|
-
throw new Error("Guid payload must be 16 bytes");
|
|
44
|
-
this.writeFixedField(e, 14, () => this.buffer.writeBytes(n));
|
|
45
|
-
}
|
|
46
|
-
writeStringField(e, r) {
|
|
47
|
-
const n = _.encode(r ?? "");
|
|
48
|
-
this.writeVariableField(e, 12, n);
|
|
49
|
-
}
|
|
50
|
-
writeBinaryField(e, r) {
|
|
51
|
-
this.writeVariableField(e, 13, r);
|
|
52
|
-
}
|
|
53
|
-
writeObjectField(e, r, n) {
|
|
54
|
-
const i = new S(r);
|
|
55
|
-
n(i);
|
|
56
|
-
const s = i.finish();
|
|
57
|
-
this.writeVariableField(e, 11, s);
|
|
58
|
-
}
|
|
59
|
-
writeArrayField(e, r, n) {
|
|
60
|
-
const i = new R(r);
|
|
61
|
-
n(i);
|
|
62
|
-
const s = i.finish();
|
|
63
|
-
this.writeVariableField(e, 9, s);
|
|
64
|
-
}
|
|
65
|
-
writeDictionaryField(e, r, n, i) {
|
|
66
|
-
const s = new W(r, n);
|
|
67
|
-
i(s);
|
|
68
|
-
const a = s.finish();
|
|
69
|
-
this.writeVariableField(e, 10, a);
|
|
70
|
-
}
|
|
71
|
-
finish() {
|
|
72
|
-
return this.closed || (this.buffer.writeByte(G), this.closed = !0, this.cached = this.buffer.toUint8Array()), this.cached;
|
|
73
|
-
}
|
|
74
|
-
writeFixedField(e, r, n) {
|
|
75
|
-
this.writeFieldHeader(e, r, 0), n();
|
|
76
|
-
}
|
|
77
|
-
writeVariableField(e, r, n) {
|
|
78
|
-
this.writeFieldHeader(e, r, n.length), this.buffer.writeBytes(n);
|
|
79
|
-
}
|
|
80
|
-
writeFieldHeader(e, r, n) {
|
|
81
|
-
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(B(r)), J(r) && this.buffer.writeVarUInt(n >>> 0);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
class R {
|
|
85
|
-
constructor(e) {
|
|
86
|
-
this.elementType = e;
|
|
87
|
-
}
|
|
88
|
-
payload = new E();
|
|
89
|
-
count = 0;
|
|
90
|
-
writeInt32(e) {
|
|
91
|
-
this.ensureElementType(
|
|
92
|
-
3
|
|
93
|
-
/* Int32 */
|
|
94
|
-
), this.count++, this.payload.writeInt32(e | 0);
|
|
95
|
-
}
|
|
96
|
-
writeUInt32(e) {
|
|
97
|
-
this.ensureElementType(
|
|
98
|
-
5
|
|
99
|
-
/* UInt32 */
|
|
100
|
-
), this.count++, this.payload.writeUInt32(e >>> 0);
|
|
101
|
-
}
|
|
102
|
-
writeInt64(e) {
|
|
103
|
-
this.ensureElementType(
|
|
104
|
-
4
|
|
105
|
-
/* Int64 */
|
|
106
|
-
), this.count++, this.payload.writeBigInt64(e);
|
|
107
|
-
}
|
|
108
|
-
writeUInt64(e) {
|
|
109
|
-
this.ensureElementType(
|
|
110
|
-
6
|
|
111
|
-
/* UInt64 */
|
|
112
|
-
), this.count++, this.payload.writeBigUInt64(e);
|
|
113
|
-
}
|
|
114
|
-
writeFloat32(e) {
|
|
115
|
-
this.ensureElementType(
|
|
116
|
-
7
|
|
117
|
-
/* Float32 */
|
|
118
|
-
), this.count++, this.payload.writeFloat32(e);
|
|
119
|
-
}
|
|
120
|
-
writeFloat64(e) {
|
|
121
|
-
this.ensureElementType(
|
|
122
|
-
8
|
|
123
|
-
/* Float64 */
|
|
124
|
-
), this.count++, this.payload.writeFloat64(e);
|
|
125
|
-
}
|
|
126
|
-
writeBool(e) {
|
|
127
|
-
this.ensureElementType(
|
|
128
|
-
2
|
|
129
|
-
/* Bool */
|
|
130
|
-
), this.count++, this.payload.writeByte(e ? 1 : 0);
|
|
131
|
-
}
|
|
132
|
-
writeGuid(e) {
|
|
133
|
-
this.ensureElementType(
|
|
134
|
-
14
|
|
135
|
-
/* Guid */
|
|
136
|
-
), this.count++;
|
|
137
|
-
const r = e instanceof l ? e.asBytes() : e;
|
|
138
|
-
if (r.length !== 16)
|
|
139
|
-
throw new Error("Guid payload must be 16 bytes");
|
|
140
|
-
this.payload.writeBytes(r);
|
|
141
|
-
}
|
|
142
|
-
writeString(e) {
|
|
143
|
-
this.ensureElementType(
|
|
144
|
-
12
|
|
145
|
-
/* String */
|
|
146
|
-
), this.count++;
|
|
147
|
-
const r = _.encode(e ?? "");
|
|
148
|
-
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r);
|
|
149
|
-
}
|
|
150
|
-
writeBinary(e) {
|
|
151
|
-
this.ensureElementType(
|
|
152
|
-
13
|
|
153
|
-
/* Binary */
|
|
154
|
-
), this.count++, this.payload.writeVarUInt(e.length), this.payload.writeBytes(e);
|
|
155
|
-
}
|
|
156
|
-
writeObject(e, r) {
|
|
157
|
-
this.ensureElementType(
|
|
158
|
-
11
|
|
159
|
-
/* Object */
|
|
160
|
-
), this.count++;
|
|
161
|
-
const n = new S(e);
|
|
162
|
-
r(n);
|
|
163
|
-
const i = n.finish();
|
|
164
|
-
this.payload.writeVarUInt(i.length), this.payload.writeBytes(i);
|
|
165
|
-
}
|
|
166
|
-
writeArray(e, r) {
|
|
167
|
-
this.ensureElementType(
|
|
168
|
-
9
|
|
169
|
-
/* Array */
|
|
170
|
-
), this.count++;
|
|
171
|
-
const n = new R(e);
|
|
172
|
-
r(n);
|
|
173
|
-
const i = n.finish();
|
|
174
|
-
this.payload.writeBytes(i);
|
|
175
|
-
}
|
|
176
|
-
writeDictionary(e, r, n) {
|
|
177
|
-
this.ensureElementType(
|
|
178
|
-
10
|
|
179
|
-
/* Dict */
|
|
180
|
-
), this.count++;
|
|
181
|
-
const i = new W(e, r);
|
|
182
|
-
n(i);
|
|
183
|
-
const s = i.finish();
|
|
184
|
-
this.payload.writeBytes(s);
|
|
185
|
-
}
|
|
186
|
-
finish() {
|
|
187
|
-
const e = new E();
|
|
188
|
-
return e.writeByte(B(this.elementType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
189
|
-
}
|
|
190
|
-
ensureElementType(e) {
|
|
191
|
-
if (this.elementType !== e)
|
|
192
|
-
throw new Error(`Array element type is ${m[this.elementType]}, expected ${m[e]}`);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
class W {
|
|
196
|
-
constructor(e, r) {
|
|
197
|
-
this.keyType = e, this.valueType = r, X(e);
|
|
198
|
-
}
|
|
199
|
-
payload = new E();
|
|
200
|
-
count = 0;
|
|
201
|
-
entryOpen = !1;
|
|
202
|
-
beginEntry() {
|
|
203
|
-
if (this.entryOpen)
|
|
204
|
-
throw new Error("Previous dictionary entry not completed");
|
|
205
|
-
return this.count++, this.entryOpen = !0, new Y(this.keyType, this.valueType, this.payload, () => {
|
|
206
|
-
this.entryOpen = !1;
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
finish() {
|
|
210
|
-
if (this.entryOpen)
|
|
211
|
-
throw new Error("Dictionary entry not completed");
|
|
212
|
-
const e = new E();
|
|
213
|
-
return e.writeByte(B(this.keyType)), e.writeByte(B(this.valueType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
class Y {
|
|
217
|
-
constructor(e, r, n, i) {
|
|
218
|
-
this.keyType = e, this.valueType = r, this.payload = n, this.onComplete = i;
|
|
219
|
-
}
|
|
220
|
-
keyWritten = !1;
|
|
221
|
-
valueWritten = !1;
|
|
222
|
-
completed = !1;
|
|
223
|
-
writeKeyInt32(e) {
|
|
224
|
-
this.ensureKeyType(
|
|
225
|
-
3
|
|
226
|
-
/* Int32 */
|
|
227
|
-
), this.payload.writeInt32(e | 0), this.keyWritten = !0;
|
|
228
|
-
}
|
|
229
|
-
writeKeyUInt32(e) {
|
|
230
|
-
this.ensureKeyType(
|
|
231
|
-
5
|
|
232
|
-
/* UInt32 */
|
|
233
|
-
), this.payload.writeUInt32(e >>> 0), this.keyWritten = !0;
|
|
234
|
-
}
|
|
235
|
-
writeKeyInt64(e) {
|
|
236
|
-
this.ensureKeyType(
|
|
237
|
-
4
|
|
238
|
-
/* Int64 */
|
|
239
|
-
), this.payload.writeBigInt64(e), this.keyWritten = !0;
|
|
240
|
-
}
|
|
241
|
-
writeKeyUInt64(e) {
|
|
242
|
-
this.ensureKeyType(
|
|
243
|
-
6
|
|
244
|
-
/* UInt64 */
|
|
245
|
-
), this.payload.writeBigUInt64(e), this.keyWritten = !0;
|
|
246
|
-
}
|
|
247
|
-
writeKeyFloat32(e) {
|
|
248
|
-
this.ensureKeyType(
|
|
249
|
-
7
|
|
250
|
-
/* Float32 */
|
|
251
|
-
), this.payload.writeFloat32(e), this.keyWritten = !0;
|
|
252
|
-
}
|
|
253
|
-
writeKeyFloat64(e) {
|
|
254
|
-
this.ensureKeyType(
|
|
255
|
-
8
|
|
256
|
-
/* Float64 */
|
|
257
|
-
), this.payload.writeFloat64(e), this.keyWritten = !0;
|
|
258
|
-
}
|
|
259
|
-
writeKeyBool(e) {
|
|
260
|
-
this.ensureKeyType(
|
|
261
|
-
2
|
|
262
|
-
/* Bool */
|
|
263
|
-
), this.payload.writeByte(e ? 1 : 0), this.keyWritten = !0;
|
|
264
|
-
}
|
|
265
|
-
writeKeyGuid(e) {
|
|
266
|
-
this.ensureKeyType(
|
|
267
|
-
14
|
|
268
|
-
/* Guid */
|
|
269
|
-
);
|
|
270
|
-
const r = e instanceof l ? e.asBytes() : e;
|
|
271
|
-
if (r.length !== 16)
|
|
272
|
-
throw new Error("Guid payload must be 16 bytes");
|
|
273
|
-
this.payload.writeBytes(r), this.keyWritten = !0;
|
|
274
|
-
}
|
|
275
|
-
writeKeyString(e) {
|
|
276
|
-
this.ensureKeyType(
|
|
277
|
-
12
|
|
278
|
-
/* String */
|
|
279
|
-
);
|
|
280
|
-
const r = _.encode(e ?? "");
|
|
281
|
-
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r), this.keyWritten = !0;
|
|
282
|
-
}
|
|
283
|
-
writeKeyBinary(e) {
|
|
284
|
-
this.ensureKeyType(
|
|
285
|
-
13
|
|
286
|
-
/* Binary */
|
|
287
|
-
), this.payload.writeVarUInt(e.length), this.payload.writeBytes(e), this.keyWritten = !0;
|
|
288
|
-
}
|
|
289
|
-
writeValueInt32(e) {
|
|
290
|
-
this.ensureValueType(
|
|
291
|
-
3
|
|
292
|
-
/* Int32 */
|
|
293
|
-
), this.payload.writeInt32(e | 0), this.valueWritten = !0;
|
|
294
|
-
}
|
|
295
|
-
writeValueUInt32(e) {
|
|
296
|
-
this.ensureValueType(
|
|
297
|
-
5
|
|
298
|
-
/* UInt32 */
|
|
299
|
-
), this.payload.writeUInt32(e >>> 0), this.valueWritten = !0;
|
|
300
|
-
}
|
|
301
|
-
writeValueInt64(e) {
|
|
302
|
-
this.ensureValueType(
|
|
303
|
-
4
|
|
304
|
-
/* Int64 */
|
|
305
|
-
), this.payload.writeBigInt64(e), this.valueWritten = !0;
|
|
306
|
-
}
|
|
307
|
-
writeValueUInt64(e) {
|
|
308
|
-
this.ensureValueType(
|
|
309
|
-
6
|
|
310
|
-
/* UInt64 */
|
|
311
|
-
), this.payload.writeBigUInt64(e), this.valueWritten = !0;
|
|
312
|
-
}
|
|
313
|
-
writeValueFloat32(e) {
|
|
314
|
-
this.ensureValueType(
|
|
315
|
-
7
|
|
316
|
-
/* Float32 */
|
|
317
|
-
), this.payload.writeFloat32(e), this.valueWritten = !0;
|
|
318
|
-
}
|
|
319
|
-
writeValueFloat64(e) {
|
|
320
|
-
this.ensureValueType(
|
|
321
|
-
8
|
|
322
|
-
/* Float64 */
|
|
323
|
-
), this.payload.writeFloat64(e), this.valueWritten = !0;
|
|
324
|
-
}
|
|
325
|
-
writeValueBool(e) {
|
|
326
|
-
this.ensureValueType(
|
|
327
|
-
2
|
|
328
|
-
/* Bool */
|
|
329
|
-
), this.payload.writeByte(e ? 1 : 0), this.valueWritten = !0;
|
|
330
|
-
}
|
|
331
|
-
writeValueGuid(e) {
|
|
332
|
-
this.ensureValueType(
|
|
333
|
-
14
|
|
334
|
-
/* Guid */
|
|
335
|
-
);
|
|
336
|
-
const r = e instanceof l ? e.asBytes() : e;
|
|
337
|
-
if (r.length !== 16)
|
|
338
|
-
throw new Error("Guid payload must be 16 bytes");
|
|
339
|
-
this.payload.writeBytes(r), this.valueWritten = !0;
|
|
340
|
-
}
|
|
341
|
-
writeNullValue() {
|
|
342
|
-
this.ensureValueType(
|
|
343
|
-
1
|
|
344
|
-
/* Null */
|
|
345
|
-
), this.valueWritten = !0;
|
|
346
|
-
}
|
|
347
|
-
writeValueBinary(e) {
|
|
348
|
-
this.ensureValueType(
|
|
349
|
-
13
|
|
350
|
-
/* Binary */
|
|
351
|
-
), this.payload.writeVarUInt(e.length), this.payload.writeBytes(e), this.valueWritten = !0;
|
|
352
|
-
}
|
|
353
|
-
writeValueString(e) {
|
|
354
|
-
this.ensureValueType(
|
|
355
|
-
12
|
|
356
|
-
/* String */
|
|
357
|
-
);
|
|
358
|
-
const r = _.encode(e ?? "");
|
|
359
|
-
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r), this.valueWritten = !0;
|
|
360
|
-
}
|
|
361
|
-
writeValueObject(e, r) {
|
|
362
|
-
this.ensureValueType(
|
|
363
|
-
11
|
|
364
|
-
/* Object */
|
|
365
|
-
);
|
|
366
|
-
const n = new S(e);
|
|
367
|
-
r(n);
|
|
368
|
-
const i = n.finish();
|
|
369
|
-
this.payload.writeVarUInt(i.length), this.payload.writeBytes(i), this.valueWritten = !0;
|
|
370
|
-
}
|
|
371
|
-
writeValueArray(e, r) {
|
|
372
|
-
this.ensureValueType(
|
|
373
|
-
9
|
|
374
|
-
/* Array */
|
|
375
|
-
);
|
|
376
|
-
const n = new R(e);
|
|
377
|
-
r(n);
|
|
378
|
-
const i = n.finish();
|
|
379
|
-
this.payload.writeBytes(i), this.valueWritten = !0;
|
|
380
|
-
}
|
|
381
|
-
writeValueDictionary(e, r, n) {
|
|
382
|
-
this.ensureValueType(
|
|
383
|
-
10
|
|
384
|
-
/* Dict */
|
|
385
|
-
);
|
|
386
|
-
const i = new W(e, r);
|
|
387
|
-
n(i);
|
|
388
|
-
const s = i.finish();
|
|
389
|
-
this.payload.writeBytes(s), this.valueWritten = !0;
|
|
390
|
-
}
|
|
391
|
-
complete() {
|
|
392
|
-
if (!this.completed) {
|
|
393
|
-
if (!this.keyWritten || !this.valueWritten)
|
|
394
|
-
throw new Error("Dictionary entry must write both key and value");
|
|
395
|
-
this.completed = !0, this.onComplete();
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
ensureKeyType(e) {
|
|
399
|
-
if (this.keyType !== e)
|
|
400
|
-
throw new Error(`Dictionary key type is ${m[this.keyType]}, expected ${m[e]}`);
|
|
401
|
-
}
|
|
402
|
-
ensureValueType(e) {
|
|
403
|
-
if (this.valueType !== e)
|
|
404
|
-
throw new Error(`Dictionary value type is ${m[this.valueType]}, expected ${m[e]}`);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
class l {
|
|
408
|
-
constructor(e) {
|
|
409
|
-
this.bytes = e;
|
|
410
|
-
}
|
|
411
|
-
static fromString(e) {
|
|
412
|
-
if (!e)
|
|
413
|
-
throw new Error("Guid string is empty");
|
|
414
|
-
const r = e.replace(/-/g, "");
|
|
415
|
-
if (r.length !== 32)
|
|
416
|
-
throw new Error("Guid string must be 32 hex characters");
|
|
417
|
-
const n = new Uint8Array(16), i = l.parseHexSlice(r, 0, 8), s = l.parseHexSlice(r, 8, 4), a = l.parseHexSlice(r, 12, 4);
|
|
418
|
-
l.writeUInt32LE(n, 0, i), l.writeUInt16LE(n, 4, s), l.writeUInt16LE(n, 6, a);
|
|
419
|
-
for (let c = 0; c < 8; c++)
|
|
420
|
-
n[8 + c] = l.parseHexSlice(r, 16 + c * 2, 2);
|
|
421
|
-
return new l(n);
|
|
422
|
-
}
|
|
423
|
-
static fromBytes(e) {
|
|
424
|
-
if (e.length !== 16)
|
|
425
|
-
throw new Error("Guid byte array must be 16 bytes");
|
|
426
|
-
return new l(Uint8Array.from(e));
|
|
427
|
-
}
|
|
428
|
-
static createZero() {
|
|
429
|
-
return new l(new Uint8Array(16));
|
|
430
|
-
}
|
|
431
|
-
static createRandom() {
|
|
432
|
-
const e = new Uint8Array(16), r = globalThis.crypto;
|
|
433
|
-
if (r?.getRandomValues)
|
|
434
|
-
r.getRandomValues(e);
|
|
435
|
-
else
|
|
436
|
-
for (let n = 0; n < e.length; n++)
|
|
437
|
-
e[n] = Math.floor(Math.random() * 256);
|
|
438
|
-
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new l(e);
|
|
439
|
-
}
|
|
440
|
-
toString() {
|
|
441
|
-
const e = this.bytes;
|
|
442
|
-
return [
|
|
443
|
-
l.toHex(l.readUInt32LE(e, 0), 8),
|
|
444
|
-
l.toHex(l.readUInt16LE(e, 4), 4),
|
|
445
|
-
l.toHex(l.readUInt16LE(e, 6), 4),
|
|
446
|
-
k(e.subarray(8, 10)),
|
|
447
|
-
k(e.subarray(10, 16))
|
|
448
|
-
].join("-");
|
|
449
|
-
}
|
|
450
|
-
asBytes() {
|
|
451
|
-
return this.bytes.slice();
|
|
452
|
-
}
|
|
453
|
-
static parseHexSlice(e, r, n) {
|
|
454
|
-
const i = e.substr(r, n), s = Number.parseInt(i, 16);
|
|
455
|
-
if (Number.isNaN(s))
|
|
456
|
-
throw new Error("Guid string contains invalid characters");
|
|
457
|
-
return s >>> 0;
|
|
458
|
-
}
|
|
459
|
-
static writeUInt32LE(e, r, n) {
|
|
460
|
-
const i = n >>> 0;
|
|
461
|
-
e[r] = i & 255, e[r + 1] = i >>> 8 & 255, e[r + 2] = i >>> 16 & 255, e[r + 3] = i >>> 24 & 255;
|
|
462
|
-
}
|
|
463
|
-
static writeUInt16LE(e, r, n) {
|
|
464
|
-
const i = n & 65535;
|
|
465
|
-
e[r] = i & 255, e[r + 1] = i >>> 8 & 255;
|
|
466
|
-
}
|
|
467
|
-
static readUInt32LE(e, r) {
|
|
468
|
-
return (e[r] | e[r + 1] << 8 | e[r + 2] << 16 | e[r + 3] << 24) >>> 0;
|
|
469
|
-
}
|
|
470
|
-
static readUInt16LE(e, r) {
|
|
471
|
-
return (e[r] | e[r + 1] << 8) & 65535;
|
|
472
|
-
}
|
|
473
|
-
static toHex(e, r) {
|
|
474
|
-
return (e >>> 0).toString(16).padStart(r, "0");
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
class E {
|
|
478
|
-
static INITIAL_CAPACITY = 256;
|
|
479
|
-
buffer;
|
|
480
|
-
dataView;
|
|
481
|
-
length = 0;
|
|
482
|
-
constructor() {
|
|
483
|
-
this.buffer = new Uint8Array(E.INITIAL_CAPACITY), this.dataView = new DataView(this.buffer.buffer);
|
|
484
|
-
}
|
|
485
|
-
ensureCapacity(e) {
|
|
486
|
-
const r = this.length + e;
|
|
487
|
-
if (r <= this.buffer.length)
|
|
488
|
-
return;
|
|
489
|
-
let n = this.buffer.length;
|
|
490
|
-
for (; n < r; )
|
|
491
|
-
n *= 2;
|
|
492
|
-
const i = new Uint8Array(n);
|
|
493
|
-
i.set(this.buffer.subarray(0, this.length)), this.buffer = i, this.dataView = new DataView(this.buffer.buffer);
|
|
494
|
-
}
|
|
495
|
-
writeByte(e) {
|
|
496
|
-
this.ensureCapacity(1), this.buffer[this.length++] = e & 255;
|
|
497
|
-
}
|
|
498
|
-
writeBytes(e) {
|
|
499
|
-
this.ensureCapacity(e.length), this.buffer.set(e, this.length), this.length += e.length;
|
|
500
|
-
}
|
|
501
|
-
writeUInt32(e) {
|
|
502
|
-
this.ensureCapacity(4), this.dataView.setUint32(this.length, e >>> 0, !0), this.length += 4;
|
|
503
|
-
}
|
|
504
|
-
writeInt32(e) {
|
|
505
|
-
this.ensureCapacity(4), this.dataView.setInt32(this.length, e | 0, !0), this.length += 4;
|
|
506
|
-
}
|
|
507
|
-
writeFloat32(e) {
|
|
508
|
-
this.ensureCapacity(4), this.dataView.setFloat32(this.length, e, !0), this.length += 4;
|
|
509
|
-
}
|
|
510
|
-
writeFloat64(e) {
|
|
511
|
-
this.ensureCapacity(8), this.dataView.setFloat64(this.length, e, !0), this.length += 8;
|
|
512
|
-
}
|
|
513
|
-
writeBigInt64(e) {
|
|
514
|
-
this.ensureCapacity(8), this.dataView.setBigInt64(this.length, e, !0), this.length += 8;
|
|
515
|
-
}
|
|
516
|
-
writeBigUInt64(e) {
|
|
517
|
-
this.ensureCapacity(8), this.dataView.setBigUint64(this.length, e, !0), this.length += 8;
|
|
518
|
-
}
|
|
519
|
-
writeVarUInt(e) {
|
|
520
|
-
let r = e >>> 0;
|
|
521
|
-
for (; r >= 128; )
|
|
522
|
-
this.ensureCapacity(1), this.buffer[this.length++] = r & 127 | 128, r >>>= 7;
|
|
523
|
-
this.ensureCapacity(1), this.buffer[this.length++] = r & 127;
|
|
524
|
-
}
|
|
525
|
-
toUint8Array() {
|
|
526
|
-
return this.buffer.slice(0, this.length);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
function B(t, e = 0) {
|
|
530
|
-
if ((e & 240) !== 0)
|
|
531
|
-
throw new Error("Teleport flags must fit into 4 bits");
|
|
532
|
-
return (t & 15) << 4 | e & 15;
|
|
533
|
-
}
|
|
534
|
-
function J(t) {
|
|
535
|
-
return t === 12 || t === 13 || t === 9 || t === 11 || t === 10;
|
|
536
|
-
}
|
|
537
|
-
function X(t) {
|
|
538
|
-
if (t === 9 || t === 11 || t === 10 || t === 1)
|
|
539
|
-
throw new Error("Dictionary keys must be primitive Teleport types");
|
|
540
|
-
}
|
|
541
|
-
function k(t) {
|
|
542
|
-
return Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
543
|
-
}
|
|
544
|
-
var P = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.Opus = 1] = "Opus", t[t.Mp3 = 2] = "Mp3", t[t.RawPcm16 = 3] = "RawPcm16", t))(P || {});
|
|
545
|
-
const z = 1, Z = 4194309, Q = 205938238, ee = 1594075008, te = 2026534360, re = 3409001585, ne = 3466650495, ie = 4007456593, se = 4017217601, ae = 4065417427, oe = 4086360332;
|
|
546
|
-
function ce(t) {
|
|
547
|
-
const e = {};
|
|
548
|
-
return ue(e), t && Object.assign(e, t), e;
|
|
549
|
-
}
|
|
550
|
-
function ue(t) {
|
|
551
|
-
return t.Samples = new Uint8Array(0), t.Epoch = 0, t.Sequence = 0, t.FrameSizeInInterleavedSamples = 0, t.TimeStampInInterleavedSamples = 0n, t.IsFirst = !1, t.IsLast = !1, t.AverageVolume = 0, t.AudioEventEstimatedDuration = 0, t;
|
|
552
|
-
}
|
|
553
|
-
function le(t) {
|
|
554
|
-
const e = new S(z);
|
|
555
|
-
return de(t, e), e.finish();
|
|
556
|
-
}
|
|
557
|
-
function de(t, e) {
|
|
558
|
-
e.writeFloat32Field(Q, t.AverageVolume), e.writeBoolField(ee, t.IsFirst), e.writeUInt64Field(te, t.TimeStampInInterleavedSamples), e.writeBinaryField(re, t.Samples), e.writeFloat32Field(ne, t.AudioEventEstimatedDuration), e.writeUInt32Field(ie, t.FrameSizeInInterleavedSamples >>> 0), e.writeBoolField(se, t.IsLast), e.writeUInt32Field(ae, t.Sequence >>> 0), e.writeUInt32Field(oe, t.Epoch >>> 0);
|
|
559
|
-
}
|
|
560
|
-
function he(t, e, r) {
|
|
561
|
-
const n = le(t);
|
|
562
|
-
return L(Z, n, z, e, r);
|
|
563
|
-
}
|
|
564
|
-
const H = 6, fe = 4194305, pe = 161083277, ye = 265814330, we = 1368629611, Ie = 2431514951, me = 2514959030, ge = 2745379226, Ee = 3282782683, Se = 3284746250, Ae = 4101844078;
|
|
565
|
-
function be(t) {
|
|
566
|
-
const e = {};
|
|
567
|
-
return Fe(e), t && Object.assign(e, t), e;
|
|
568
|
-
}
|
|
569
|
-
function Fe(t) {
|
|
570
|
-
return t.StreamId = "", t.Description = "", t.SourceType = "", t.Codec = P.Unknown, t.CodecDetails = "", t.SampleRate = 0, t.Channels = 0, t.ShapeSets = void 0, t.CorrelationId = void 0, t;
|
|
571
|
-
}
|
|
572
|
-
function Ue(t) {
|
|
573
|
-
const e = new S(H);
|
|
574
|
-
return _e(t, e), e.finish();
|
|
575
|
-
}
|
|
576
|
-
function _e(t, e) {
|
|
577
|
-
e.writeStringField(pe, t.StreamId);
|
|
578
|
-
const r = t.ShapeSets;
|
|
579
|
-
r != null && e.writeArrayField(ye, m.Object, (i) => {
|
|
580
|
-
for (const s of r)
|
|
581
|
-
i.writeObject(Oe, (a) => {
|
|
582
|
-
Te(s, a);
|
|
583
|
-
});
|
|
584
|
-
}), e.writeStringField(we, t.Description), e.writeInt32Field(Ie, t.Channels | 0);
|
|
585
|
-
const n = t.CorrelationId;
|
|
586
|
-
n != null && e.writeStringField(me, n), e.writeStringField(ge, t.CodecDetails), e.writeStringField(Ee, t.SourceType), e.writeInt32Field(Se, t.Codec), e.writeInt32Field(Ae, t.SampleRate | 0);
|
|
587
|
-
}
|
|
588
|
-
function Be(t, e, r) {
|
|
589
|
-
const n = Ue(t);
|
|
590
|
-
return L(fe, n, H, e, r);
|
|
591
|
-
}
|
|
592
|
-
const Oe = 6, De = 1107713536, Re = 1154362099, Me = 1185721362;
|
|
593
|
-
function Te(t, e) {
|
|
594
|
-
e.writeStringField(De, t.Name), e.writeUInt32Field(Re, t.SetId >>> 0), e.writeArrayField(Me, m.String, (r) => {
|
|
595
|
-
for (const n of t.ShapeNames)
|
|
596
|
-
r.writeString(n);
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
const K = 1, Ve = 4194306;
|
|
600
|
-
function Le(t) {
|
|
601
|
-
const e = {};
|
|
602
|
-
return t && Object.assign(e, t), e;
|
|
603
|
-
}
|
|
604
|
-
function We(t) {
|
|
605
|
-
return new S(K).finish();
|
|
606
|
-
}
|
|
607
|
-
function Pe(t, e, r) {
|
|
608
|
-
const n = We();
|
|
609
|
-
return L(Ve, n, K, e, r);
|
|
610
|
-
}
|
|
611
|
-
class Ce {
|
|
612
|
-
static getStorageForCapacity(e, r) {
|
|
613
|
-
const n = Int32Array.BYTES_PER_ELEMENT * 2, i = r.BYTES_PER_ELEMENT * e;
|
|
614
|
-
return new SharedArrayBuffer(n + i);
|
|
615
|
-
}
|
|
616
|
-
readWrite;
|
|
617
|
-
storage;
|
|
618
|
-
buf;
|
|
619
|
-
constructor(e, r) {
|
|
620
|
-
this.buf = e, this.readWrite = new Int32Array(e, 0, 2);
|
|
621
|
-
const n = Int32Array.BYTES_PER_ELEMENT * 2, i = (e.byteLength - n) / Float32Array.BYTES_PER_ELEMENT;
|
|
622
|
-
this.storage = new r(e, n, i);
|
|
623
|
-
}
|
|
624
|
-
get capacity() {
|
|
625
|
-
return this.storage.length;
|
|
626
|
-
}
|
|
627
|
-
flush() {
|
|
628
|
-
Atomics.store(this.readWrite, 0, 0), Atomics.store(this.readWrite, 1, 0);
|
|
629
|
-
}
|
|
630
|
-
availableRead() {
|
|
631
|
-
const e = Atomics.load(this.readWrite, 0), r = Atomics.load(this.readWrite, 1);
|
|
632
|
-
return r >= e ? r - e : this.capacity - (e - r);
|
|
633
|
-
}
|
|
634
|
-
availableWrite() {
|
|
635
|
-
return this.capacity - this.availableRead() - 1;
|
|
636
|
-
}
|
|
637
|
-
push(e) {
|
|
638
|
-
const r = Math.min(this.availableWrite(), e.length);
|
|
639
|
-
if (r <= 0)
|
|
640
|
-
return 0;
|
|
641
|
-
let n = Atomics.load(this.readWrite, 1);
|
|
642
|
-
const i = Math.min(r, this.capacity - n);
|
|
643
|
-
this.storage.set(e.subarray(0, i), n);
|
|
644
|
-
const s = r - i;
|
|
645
|
-
return s > 0 && this.storage.set(e.subarray(i, i + s), 0), n = (n + r) % this.capacity, Atomics.store(this.readWrite, 1, n), Atomics.notify(this.readWrite, 1), r;
|
|
646
|
-
}
|
|
647
|
-
pop(e) {
|
|
648
|
-
const r = Math.min(this.availableRead(), e.length);
|
|
649
|
-
if (r <= 0)
|
|
650
|
-
return 0;
|
|
651
|
-
let n = Atomics.load(this.readWrite, 0);
|
|
652
|
-
const i = Math.min(r, this.capacity - n);
|
|
653
|
-
e.set(this.storage.subarray(n, n + i), 0);
|
|
654
|
-
const s = r - i;
|
|
655
|
-
return s > 0 && e.set(this.storage.subarray(0, s), i), n = (n + r) % this.capacity, Atomics.store(this.readWrite, 0, n), r;
|
|
656
|
-
}
|
|
657
|
-
skip(e) {
|
|
658
|
-
const r = Math.min(this.availableRead(), e);
|
|
659
|
-
if (r <= 0)
|
|
660
|
-
return 0;
|
|
661
|
-
let n = Atomics.load(this.readWrite, 0);
|
|
662
|
-
return n = (n + r) % this.capacity, Atomics.store(this.readWrite, 0, n), r;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
let ve = 1;
|
|
666
|
-
const Ne = /* @__PURE__ */ new Map(), ke = {
|
|
667
|
-
0: "DEBUG",
|
|
668
|
-
1: "INFO",
|
|
669
|
-
2: "WARN",
|
|
670
|
-
3: "ERROR",
|
|
671
|
-
4: "NONE"
|
|
672
|
-
};
|
|
673
|
-
function xe(t, e) {
|
|
674
|
-
return `[${t}] ${e}`;
|
|
675
|
-
}
|
|
676
|
-
function F(t, e, r, n) {
|
|
677
|
-
const i = (/* @__PURE__ */ new Date()).toISOString(), s = ke[t], a = {
|
|
678
|
-
timestamp: i,
|
|
679
|
-
level: t,
|
|
680
|
-
levelName: s,
|
|
681
|
-
component: e,
|
|
682
|
-
message: r,
|
|
683
|
-
args: n
|
|
684
|
-
};
|
|
685
|
-
for (const [c, d] of Ne) {
|
|
686
|
-
const o = d?.minLevel ?? 2;
|
|
687
|
-
if (t >= o)
|
|
688
|
-
try {
|
|
689
|
-
c(a);
|
|
690
|
-
} catch {
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
if (ve <= t) {
|
|
694
|
-
const c = xe(e, r);
|
|
695
|
-
switch (t) {
|
|
696
|
-
case 0:
|
|
697
|
-
console.debug(c, ...n);
|
|
698
|
-
break;
|
|
699
|
-
case 1:
|
|
700
|
-
console.info(c, ...n);
|
|
701
|
-
break;
|
|
702
|
-
case 2:
|
|
703
|
-
console.warn(c, ...n);
|
|
704
|
-
break;
|
|
705
|
-
case 3:
|
|
706
|
-
console.error(c, ...n);
|
|
707
|
-
break;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
function ze(t) {
|
|
712
|
-
return {
|
|
713
|
-
debug(e, ...r) {
|
|
714
|
-
F(0, t, e, r);
|
|
715
|
-
},
|
|
716
|
-
info(e, ...r) {
|
|
717
|
-
F(1, t, e, r);
|
|
718
|
-
},
|
|
719
|
-
warn(e, ...r) {
|
|
720
|
-
F(2, t, e, r);
|
|
721
|
-
},
|
|
722
|
-
error(e, ...r) {
|
|
723
|
-
F(3, t, e, r);
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
const He = 20, b = 32e3, Ke = 5, M = 8e3, g = ze("AudioCaptureWorker");
|
|
728
|
-
class $ {
|
|
729
|
-
encoder = null;
|
|
730
|
-
isReady = !1;
|
|
731
|
-
sampleRate;
|
|
732
|
-
channels;
|
|
733
|
-
bitrate;
|
|
734
|
-
frameSize;
|
|
735
|
-
onOutput;
|
|
736
|
-
onError;
|
|
737
|
-
timestampUs = 0;
|
|
738
|
-
frameDurationUs;
|
|
739
|
-
constructor(e) {
|
|
740
|
-
this.sampleRate = e.sampleRate, this.channels = e.channels, this.bitrate = e.bitrate, this.frameSize = e.frameSize, this.frameDurationUs = Math.floor(this.frameSize * 1e6 / this.sampleRate), this.onOutput = e.onOutput, this.onError = e.onError;
|
|
741
|
-
}
|
|
742
|
-
async initialize() {
|
|
743
|
-
try {
|
|
744
|
-
const { OpusEncoder: e, OPUS_APPLICATION_VOIP: r, getOpusModule: n } = await import("./index-D_vz6N3U.js");
|
|
745
|
-
await n(), this.encoder = new e({
|
|
746
|
-
sampleRate: this.sampleRate,
|
|
747
|
-
channels: this.channels,
|
|
748
|
-
bitrate: this.bitrate,
|
|
749
|
-
application: r,
|
|
750
|
-
complexity: Ke
|
|
751
|
-
}), await this.encoder.ready, this.isReady = !0;
|
|
752
|
-
} catch (e) {
|
|
753
|
-
this.onError(e instanceof Error ? e : new Error(String(e)));
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
encode(e) {
|
|
757
|
-
if (!(!this.isReady || !this.encoder))
|
|
758
|
-
try {
|
|
759
|
-
let r;
|
|
760
|
-
if (e instanceof Float32Array)
|
|
761
|
-
r = e;
|
|
762
|
-
else {
|
|
763
|
-
const i = e.numberOfFrames, s = e.numberOfChannels;
|
|
764
|
-
r = new Float32Array(i * s), e.copyTo(r, { planeIndex: 0, format: "f32" }), e.close();
|
|
765
|
-
}
|
|
766
|
-
const n = this.encoder.encodeAndCopy(r);
|
|
767
|
-
this.onOutput(n, this.timestampUs, this.frameDurationUs), this.timestampUs += this.frameDurationUs;
|
|
768
|
-
} catch (r) {
|
|
769
|
-
this.onError(r instanceof Error ? r : new Error(String(r)));
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
async flush() {
|
|
773
|
-
}
|
|
774
|
-
close() {
|
|
775
|
-
try {
|
|
776
|
-
this.encoder?.destroy();
|
|
777
|
-
} catch {
|
|
778
|
-
}
|
|
779
|
-
this.encoder = null, this.isReady = !1;
|
|
780
|
-
}
|
|
781
|
-
getBitrate() {
|
|
782
|
-
return this.bitrate;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
const O = (t) => self.postMessage(t);
|
|
786
|
-
let I = null;
|
|
787
|
-
function w(t, e) {
|
|
788
|
-
const r = t instanceof Error ? t : new Error(String(t));
|
|
789
|
-
O({ type: "error", captureId: e, error: { name: r.name, message: r.message, stack: r.stack } });
|
|
790
|
-
}
|
|
791
|
-
function $e(t) {
|
|
792
|
-
return t.byteOffset === 0 && t.byteLength === t.buffer.byteLength ? t.buffer : t.slice().buffer;
|
|
793
|
-
}
|
|
794
|
-
function C(t) {
|
|
795
|
-
if (!I) {
|
|
796
|
-
g.warn("Audio capture message dropped: sendPort not available");
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
const e = $e(t);
|
|
800
|
-
I.postMessage({ type: "send", message: e }, [e]);
|
|
801
|
-
}
|
|
802
|
-
function je(t) {
|
|
803
|
-
if (t.length === 0)
|
|
804
|
-
return 0;
|
|
805
|
-
let e = 0;
|
|
806
|
-
for (let r = 0; r < t.length; r++)
|
|
807
|
-
e += Math.abs(t[r] ?? 0);
|
|
808
|
-
return e / t.length;
|
|
809
|
-
}
|
|
810
|
-
const p = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map();
|
|
811
|
-
let A = null;
|
|
812
|
-
const x = 1;
|
|
813
|
-
function qe() {
|
|
814
|
-
return typeof Atomics < "u" && typeof Atomics.waitAsync == "function";
|
|
815
|
-
}
|
|
816
|
-
async function Ge(t) {
|
|
817
|
-
if (!t.ringBuffer || !t.ringTemp)
|
|
818
|
-
return;
|
|
819
|
-
const e = t.ringBuffer, r = t.ringTemp;
|
|
820
|
-
for (; !t.stopped && t.transport === "sab"; ) {
|
|
821
|
-
try {
|
|
822
|
-
const n = e.pop(r);
|
|
823
|
-
n > 0 && T(t, r.subarray(0, n));
|
|
824
|
-
} catch (n) {
|
|
825
|
-
w(n, t.captureId);
|
|
826
|
-
}
|
|
827
|
-
try {
|
|
828
|
-
const n = Atomics.load(e.readWrite, x), i = Atomics.waitAsync(e.readWrite, x, n, 100);
|
|
829
|
-
i.async && await i.value;
|
|
830
|
-
} catch {
|
|
831
|
-
await new Promise((n) => setTimeout(n, 10));
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
function Ye() {
|
|
836
|
-
for (const t of p.values())
|
|
837
|
-
if (!(t.transport !== "sab" || !t.ringBuffer || !t.ringTemp || t.stopped))
|
|
838
|
-
try {
|
|
839
|
-
const e = t.ringBuffer.pop(t.ringTemp);
|
|
840
|
-
e > 0 && T(t, t.ringTemp.subarray(0, e));
|
|
841
|
-
} catch (e) {
|
|
842
|
-
w(e, t.captureId);
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
function Je(t) {
|
|
846
|
-
if (qe()) {
|
|
847
|
-
if (!U.has(t.captureId)) {
|
|
848
|
-
const e = Ge(t);
|
|
849
|
-
U.set(t.captureId, e), e.finally(() => {
|
|
850
|
-
U.delete(t.captureId);
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
} else
|
|
854
|
-
A === null && (A = self.setInterval(Ye, 50));
|
|
855
|
-
}
|
|
856
|
-
function Xe(t) {
|
|
857
|
-
if (U.delete(t), A !== null) {
|
|
858
|
-
let e = !1;
|
|
859
|
-
for (const r of p.values())
|
|
860
|
-
if (r.transport === "sab" && !r.stopped) {
|
|
861
|
-
e = !0;
|
|
862
|
-
break;
|
|
863
|
-
}
|
|
864
|
-
if (!e) {
|
|
865
|
-
try {
|
|
866
|
-
self.clearInterval(A);
|
|
867
|
-
} catch {
|
|
868
|
-
}
|
|
869
|
-
A = null;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
function v(t) {
|
|
874
|
-
if (t.stopped || t.isReconfiguring)
|
|
875
|
-
return;
|
|
876
|
-
if (!t.inSegment) {
|
|
877
|
-
t.pendingReadOffset = 0, t.pendingWriteOffset = 0, t.pendingSamples = 0;
|
|
878
|
-
return;
|
|
879
|
-
}
|
|
880
|
-
const e = t.frameSize, r = t.frameBuffer, n = t.pendingBuffer.length;
|
|
881
|
-
for (; t.pendingSamples >= e; ) {
|
|
882
|
-
const i = t.pendingReadOffset;
|
|
883
|
-
if (i + e <= n)
|
|
884
|
-
r.set(t.pendingBuffer.subarray(i, i + e));
|
|
885
|
-
else {
|
|
886
|
-
const a = n - i;
|
|
887
|
-
r.set(t.pendingBuffer.subarray(i, n)), r.set(t.pendingBuffer.subarray(0, e - a), a);
|
|
888
|
-
}
|
|
889
|
-
t.pendingReadOffset = (i + e) % n, t.pendingSamples -= e;
|
|
890
|
-
const s = je(r);
|
|
891
|
-
t.lastVolume = s;
|
|
892
|
-
try {
|
|
893
|
-
if (t.useWasmEncoder)
|
|
894
|
-
t.encoder.encode(r);
|
|
895
|
-
else {
|
|
896
|
-
const a = new AudioData({
|
|
897
|
-
format: "f32",
|
|
898
|
-
sampleRate: t.sampleRate,
|
|
899
|
-
numberOfFrames: e,
|
|
900
|
-
numberOfChannels: t.channels,
|
|
901
|
-
timestamp: t.timestampUs,
|
|
902
|
-
data: r.buffer
|
|
903
|
-
});
|
|
904
|
-
t.encoder.encode(a), a.close();
|
|
905
|
-
}
|
|
906
|
-
} catch (a) {
|
|
907
|
-
w(a, t.captureId);
|
|
908
|
-
}
|
|
909
|
-
t.timestampUs += t.frameDurationUs;
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
function T(t, e) {
|
|
913
|
-
if (t.stopped)
|
|
914
|
-
return;
|
|
915
|
-
const r = e.length;
|
|
916
|
-
if (r === 0)
|
|
917
|
-
return;
|
|
918
|
-
const n = t.pendingSamples + r;
|
|
919
|
-
if (n > t.pendingBuffer.length) {
|
|
920
|
-
const a = Math.max(n, t.pendingBuffer.length * 2), c = new Float32Array(a);
|
|
921
|
-
if (t.pendingSamples > 0) {
|
|
922
|
-
const d = t.pendingBuffer.length;
|
|
923
|
-
if (t.pendingReadOffset + t.pendingSamples <= d)
|
|
924
|
-
c.set(t.pendingBuffer.subarray(t.pendingReadOffset, t.pendingReadOffset + t.pendingSamples));
|
|
925
|
-
else {
|
|
926
|
-
const o = d - t.pendingReadOffset;
|
|
927
|
-
c.set(t.pendingBuffer.subarray(t.pendingReadOffset, d)), c.set(t.pendingBuffer.subarray(0, t.pendingSamples - o), o);
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
t.pendingBuffer = c, t.pendingReadOffset = 0, t.pendingWriteOffset = t.pendingSamples;
|
|
931
|
-
}
|
|
932
|
-
const i = t.pendingBuffer.length, s = Math.min(r, i - t.pendingWriteOffset);
|
|
933
|
-
t.pendingBuffer.set(e.subarray(0, s), t.pendingWriteOffset), s < r && t.pendingBuffer.set(e.subarray(s), 0), t.pendingWriteOffset = (t.pendingWriteOffset + r) % i, t.pendingSamples += r, v(t);
|
|
934
|
-
}
|
|
935
|
-
function D(t, e, r, n, i = !0) {
|
|
936
|
-
const s = p.get(t.captureId);
|
|
937
|
-
if (!s || s.stopped || !s.inSegment && !s.segmentEndPending)
|
|
938
|
-
return;
|
|
939
|
-
const a = e.byteLength;
|
|
940
|
-
s.encoderOutputBuffer.length < a && (s.encoderOutputBuffer = new Uint8Array(Math.max(a, s.encoderOutputBuffer.length * 2))), s.encoderOutputBuffer.set(e);
|
|
941
|
-
const c = s.encoderOutputBuffer.subarray(0, a), d = s.segmentStartPending;
|
|
942
|
-
d && (s.segmentStartPending = !1, s.epoch++, s.sequence = 0);
|
|
943
|
-
const o = s.segmentEndPending;
|
|
944
|
-
o && (s.segmentEndPending = !1, s.inSegment = !1);
|
|
945
|
-
const h = s.frameSize * s.channels, y = BigInt(Math.floor(r / 1e6 * s.sampleRate * s.channels));
|
|
946
|
-
C(
|
|
947
|
-
he(
|
|
948
|
-
ce({
|
|
949
|
-
Samples: c,
|
|
950
|
-
Epoch: s.epoch,
|
|
951
|
-
Sequence: s.sequence,
|
|
952
|
-
FrameSizeInInterleavedSamples: h,
|
|
953
|
-
TimeStampInInterleavedSamples: y,
|
|
954
|
-
IsFirst: d,
|
|
955
|
-
IsLast: o,
|
|
956
|
-
AverageVolume: s.lastVolume,
|
|
957
|
-
AudioEventEstimatedDuration: 0
|
|
958
|
-
}),
|
|
959
|
-
s.senderId,
|
|
960
|
-
{ trackId: s.trackId, targetIds: s.targetIds }
|
|
961
|
-
)
|
|
962
|
-
), s.sequence++;
|
|
963
|
-
}
|
|
964
|
-
function Ze(t) {
|
|
965
|
-
const e = Math.max(M, Math.floor(t.options?.bitrate ?? b)), r = new AudioEncoder({
|
|
966
|
-
output: (n) => {
|
|
967
|
-
const i = p.get(t.captureId);
|
|
968
|
-
if (!i)
|
|
969
|
-
return;
|
|
970
|
-
const s = n.byteLength;
|
|
971
|
-
i.encoderOutputBuffer.length < s && (i.encoderOutputBuffer = new Uint8Array(Math.max(s, i.encoderOutputBuffer.length * 2))), n.copyTo(i.encoderOutputBuffer), D(
|
|
972
|
-
i,
|
|
973
|
-
i.encoderOutputBuffer.subarray(0, s),
|
|
974
|
-
n.timestamp ?? i.timestampUs,
|
|
975
|
-
n.duration ?? i.frameDurationUs,
|
|
976
|
-
n.type === "key"
|
|
977
|
-
);
|
|
978
|
-
},
|
|
979
|
-
error: (n) => {
|
|
980
|
-
w(n, t.captureId);
|
|
981
|
-
}
|
|
982
|
-
});
|
|
983
|
-
return r.configure({
|
|
984
|
-
codec: "opus",
|
|
985
|
-
numberOfChannels: t.channels,
|
|
986
|
-
sampleRate: t.sampleRate,
|
|
987
|
-
bitrate: e,
|
|
988
|
-
bitrateMode: "constant",
|
|
989
|
-
opus: {
|
|
990
|
-
application: "lowdelay",
|
|
991
|
-
signal: "voice"
|
|
992
|
-
}
|
|
993
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
994
|
-
}), r;
|
|
995
|
-
}
|
|
996
|
-
function Qe(t) {
|
|
997
|
-
const e = Math.max(M, Math.floor(t.options?.bitrate ?? b));
|
|
998
|
-
return new $({
|
|
999
|
-
sampleRate: t.sampleRate,
|
|
1000
|
-
channels: t.channels,
|
|
1001
|
-
bitrate: e,
|
|
1002
|
-
frameSize: t.frameSize,
|
|
1003
|
-
onOutput: (r, n, i) => {
|
|
1004
|
-
const s = p.get(t.captureId);
|
|
1005
|
-
s && D(s, r, n, i, !0);
|
|
1006
|
-
},
|
|
1007
|
-
onError: (r) => {
|
|
1008
|
-
w(r, t.captureId);
|
|
1009
|
-
}
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
async function et() {
|
|
1013
|
-
if (typeof AudioEncoder > "u")
|
|
1014
|
-
return !1;
|
|
1015
|
-
try {
|
|
1016
|
-
return (await AudioEncoder.isConfigSupported({
|
|
1017
|
-
codec: "opus",
|
|
1018
|
-
numberOfChannels: 1,
|
|
1019
|
-
sampleRate: 48e3
|
|
1020
|
-
})).supported === !0;
|
|
1021
|
-
} catch {
|
|
1022
|
-
return !1;
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
async function tt(t) {
|
|
1026
|
-
if (!I)
|
|
1027
|
-
throw new Error("Audio capture worker missing send port");
|
|
1028
|
-
if (p.has(t.captureId)) {
|
|
1029
|
-
const f = p.get(t.captureId);
|
|
1030
|
-
O({ type: "started", captureId: t.captureId, sampleRate: f.sampleRate, channels: f.channels });
|
|
1031
|
-
return;
|
|
1032
|
-
}
|
|
1033
|
-
const e = Math.max(8e3, Math.floor(t.sampleRate)), r = Math.max(1, Math.floor(t.channels)), n = Math.max(1, Math.floor(e * He / 1e3)), i = Math.max(1, Math.floor(n * 1e6 / e)), s = n * 4, a = {
|
|
1034
|
-
captureId: t.captureId,
|
|
1035
|
-
streamId: t.streamId,
|
|
1036
|
-
sourceType: t.sourceType,
|
|
1037
|
-
senderId: t.senderId,
|
|
1038
|
-
trackId: t.trackId,
|
|
1039
|
-
sampleRate: e,
|
|
1040
|
-
channels: r,
|
|
1041
|
-
frameSize: n,
|
|
1042
|
-
frameDurationUs: i,
|
|
1043
|
-
timestampUs: 0,
|
|
1044
|
-
sentFirst: !1,
|
|
1045
|
-
stopped: !1,
|
|
1046
|
-
transport: t.transport,
|
|
1047
|
-
ringBuffer: null,
|
|
1048
|
-
ringTemp: null,
|
|
1049
|
-
pendingBuffer: new Float32Array(s),
|
|
1050
|
-
pendingReadOffset: 0,
|
|
1051
|
-
pendingWriteOffset: 0,
|
|
1052
|
-
pendingSamples: 0,
|
|
1053
|
-
frameBuffer: new Float32Array(n),
|
|
1054
|
-
encoderOutputBuffer: new Uint8Array(1024),
|
|
1055
|
-
inSegment: !1,
|
|
1056
|
-
segmentStartPending: !1,
|
|
1057
|
-
segmentEndPending: !1,
|
|
1058
|
-
epoch: 0,
|
|
1059
|
-
sequence: 0,
|
|
1060
|
-
lastVolume: 0,
|
|
1061
|
-
targetIds: t.options?.targetIds,
|
|
1062
|
-
options: t.options,
|
|
1063
|
-
correlationId: t.correlationId
|
|
1064
|
-
}, d = (t.options?.preferWebCodecs ?? !0) && await et();
|
|
1065
|
-
let o, h = !1;
|
|
1066
|
-
const y = Math.max(M, Math.floor(t.options?.bitrate ?? b));
|
|
1067
|
-
if (d)
|
|
1068
|
-
o = Ze(a), g.debug(
|
|
1069
|
-
`Audio capture started: encoder=WebCodecs, sampleRate=${e}Hz, channels=${r}, bitrate=${y}bps`
|
|
1070
|
-
);
|
|
1071
|
-
else {
|
|
1072
|
-
const f = Qe(a);
|
|
1073
|
-
await f.initialize(), o = f, h = !0, g.debug(
|
|
1074
|
-
`Audio capture started: encoder=WASM Opus, sampleRate=${e}Hz, channels=${r}, bitrate=${y}bps`
|
|
1075
|
-
);
|
|
1076
|
-
}
|
|
1077
|
-
const u = {
|
|
1078
|
-
...a,
|
|
1079
|
-
encoder: o,
|
|
1080
|
-
useWasmEncoder: h,
|
|
1081
|
-
isReconfiguring: !1
|
|
1082
|
-
};
|
|
1083
|
-
if (t.transport === "sab") {
|
|
1084
|
-
if (!t.sharedArrayBuffer)
|
|
1085
|
-
throw new Error("Missing SharedArrayBuffer for sab transport");
|
|
1086
|
-
const f = new Ce(t.sharedArrayBuffer, Float32Array);
|
|
1087
|
-
u.ringBuffer = f, u.ringTemp = new Float32Array(Math.max(u.frameSize * 4, 4096)), Je(u);
|
|
1088
|
-
}
|
|
1089
|
-
p.set(t.captureId, u), C(
|
|
1090
|
-
Be(
|
|
1091
|
-
be({
|
|
1092
|
-
StreamId: u.streamId,
|
|
1093
|
-
Description: `mic:${u.streamId}`,
|
|
1094
|
-
SourceType: u.sourceType,
|
|
1095
|
-
Codec: P.Opus,
|
|
1096
|
-
CodecDetails: "",
|
|
1097
|
-
SampleRate: u.sampleRate,
|
|
1098
|
-
Channels: u.channels,
|
|
1099
|
-
CorrelationId: u.correlationId
|
|
1100
|
-
}),
|
|
1101
|
-
u.senderId,
|
|
1102
|
-
{ trackId: u.trackId, targetIds: u.targetIds }
|
|
1103
|
-
)
|
|
1104
|
-
), O({ type: "started", captureId: t.captureId, sampleRate: e, channels: r });
|
|
1105
|
-
}
|
|
1106
|
-
async function j(t) {
|
|
1107
|
-
const e = p.get(t);
|
|
1108
|
-
if (e) {
|
|
1109
|
-
e.stopped = !0, p.delete(t);
|
|
1110
|
-
try {
|
|
1111
|
-
v(e);
|
|
1112
|
-
} catch {
|
|
1113
|
-
}
|
|
1114
|
-
try {
|
|
1115
|
-
await e.encoder.flush();
|
|
1116
|
-
} catch {
|
|
1117
|
-
}
|
|
1118
|
-
try {
|
|
1119
|
-
e.encoder.close();
|
|
1120
|
-
} catch {
|
|
1121
|
-
}
|
|
1122
|
-
C(Pe(Le({}), e.senderId, { trackId: e.trackId, targetIds: e.targetIds })), O({ type: "stopped", captureId: e.captureId }), Xe(t);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
function rt(t) {
|
|
1126
|
-
const e = p.get(t);
|
|
1127
|
-
!e || e.stopped || (e.inSegment = !0, e.segmentStartPending = !0);
|
|
1128
|
-
}
|
|
1129
|
-
function nt(t) {
|
|
1130
|
-
const e = p.get(t);
|
|
1131
|
-
if (!(!e || e.stopped || !e.inSegment) && (e.segmentEndPending = !0, v(e), e.segmentEndPending && !e.stopped)) {
|
|
1132
|
-
const r = e.frameSize - e.pendingSamples;
|
|
1133
|
-
if (r > 0) {
|
|
1134
|
-
const n = new Float32Array(r);
|
|
1135
|
-
T(e, n);
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
async function it(t, e) {
|
|
1140
|
-
const r = p.get(t);
|
|
1141
|
-
if (!r || r.stopped)
|
|
1142
|
-
return;
|
|
1143
|
-
const n = r.options?.bitrate ?? b, i = e.bitrate ?? b;
|
|
1144
|
-
if (n === i) {
|
|
1145
|
-
r.options = e;
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
r.isReconfiguring = !0, r.options = e;
|
|
1149
|
-
const s = Math.max(M, Math.floor(i));
|
|
1150
|
-
let a;
|
|
1151
|
-
if (r.useWasmEncoder) {
|
|
1152
|
-
const d = new $({
|
|
1153
|
-
sampleRate: r.sampleRate,
|
|
1154
|
-
channels: r.channels,
|
|
1155
|
-
bitrate: s,
|
|
1156
|
-
frameSize: r.frameSize,
|
|
1157
|
-
onOutput: (o, h, y) => {
|
|
1158
|
-
const u = p.get(r.captureId);
|
|
1159
|
-
!u || u.isReconfiguring || D(u, o, h, y, !0);
|
|
1160
|
-
},
|
|
1161
|
-
onError: (o) => {
|
|
1162
|
-
w(o, r.captureId);
|
|
1163
|
-
}
|
|
1164
|
-
});
|
|
1165
|
-
try {
|
|
1166
|
-
await d.initialize();
|
|
1167
|
-
} catch (o) {
|
|
1168
|
-
r.isReconfiguring = !1, w(o, t);
|
|
1169
|
-
return;
|
|
1170
|
-
}
|
|
1171
|
-
a = d;
|
|
1172
|
-
} else {
|
|
1173
|
-
const d = new AudioEncoder({
|
|
1174
|
-
output: (o) => {
|
|
1175
|
-
const h = p.get(r.captureId);
|
|
1176
|
-
if (!h || h.isReconfiguring)
|
|
1177
|
-
return;
|
|
1178
|
-
const y = o.byteLength;
|
|
1179
|
-
h.encoderOutputBuffer.length < y && (h.encoderOutputBuffer = new Uint8Array(Math.max(y, h.encoderOutputBuffer.length * 2))), o.copyTo(h.encoderOutputBuffer), D(
|
|
1180
|
-
h,
|
|
1181
|
-
h.encoderOutputBuffer.subarray(0, y),
|
|
1182
|
-
o.timestamp ?? h.timestampUs,
|
|
1183
|
-
o.duration ?? h.frameDurationUs,
|
|
1184
|
-
o.type === "key"
|
|
1185
|
-
);
|
|
1186
|
-
},
|
|
1187
|
-
error: (o) => {
|
|
1188
|
-
w(o, r.captureId);
|
|
1189
|
-
}
|
|
1190
|
-
});
|
|
1191
|
-
d.configure({
|
|
1192
|
-
codec: "opus",
|
|
1193
|
-
numberOfChannels: r.channels,
|
|
1194
|
-
sampleRate: r.sampleRate,
|
|
1195
|
-
bitrate: s,
|
|
1196
|
-
bitrateMode: "constant",
|
|
1197
|
-
opus: {
|
|
1198
|
-
application: "lowdelay",
|
|
1199
|
-
signal: "voice"
|
|
1200
|
-
}
|
|
1201
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1202
|
-
}), a = d;
|
|
1203
|
-
}
|
|
1204
|
-
const c = r.encoder;
|
|
1205
|
-
try {
|
|
1206
|
-
await c.flush();
|
|
1207
|
-
} catch {
|
|
1208
|
-
}
|
|
1209
|
-
try {
|
|
1210
|
-
c.close();
|
|
1211
|
-
} catch {
|
|
1212
|
-
}
|
|
1213
|
-
r.encoder = a, r.isReconfiguring = !1, g.debug(`Audio capture bitrate updated: ${s}bps`);
|
|
1214
|
-
}
|
|
1215
|
-
async function st() {
|
|
1216
|
-
const t = Array.from(p.keys()).map(
|
|
1217
|
-
(e) => j(e).catch(() => {
|
|
1218
|
-
})
|
|
1219
|
-
);
|
|
1220
|
-
if (await Promise.all(t), I) {
|
|
1221
|
-
try {
|
|
1222
|
-
I.close();
|
|
1223
|
-
} catch {
|
|
1224
|
-
}
|
|
1225
|
-
I = null;
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
self.addEventListener("message", (t) => {
|
|
1229
|
-
const e = t.data;
|
|
1230
|
-
if (e.type === "attachSendPort") {
|
|
1231
|
-
if (I)
|
|
1232
|
-
try {
|
|
1233
|
-
I.close();
|
|
1234
|
-
} catch {
|
|
1235
|
-
}
|
|
1236
|
-
I = e.port;
|
|
1237
|
-
try {
|
|
1238
|
-
I.start?.();
|
|
1239
|
-
} catch {
|
|
1240
|
-
}
|
|
1241
|
-
return;
|
|
1242
|
-
}
|
|
1243
|
-
if (e.type === "start") {
|
|
1244
|
-
tt(e).catch((r) => {
|
|
1245
|
-
w(r, e.captureId);
|
|
1246
|
-
});
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
if (e.type === "pcm") {
|
|
1250
|
-
const r = p.get(e.captureId);
|
|
1251
|
-
if (!r || r.stopped)
|
|
1252
|
-
return;
|
|
1253
|
-
T(r, e.pcm);
|
|
1254
|
-
return;
|
|
1255
|
-
}
|
|
1256
|
-
if (e.type === "stop") {
|
|
1257
|
-
j(e.captureId).catch((r) => {
|
|
1258
|
-
g.warn(`Failed to stop audio capture: ${r}`), w(r, e.captureId);
|
|
1259
|
-
});
|
|
1260
|
-
return;
|
|
1261
|
-
}
|
|
1262
|
-
if (e.type === "startSegment") {
|
|
1263
|
-
rt(e.captureId);
|
|
1264
|
-
return;
|
|
1265
|
-
}
|
|
1266
|
-
if (e.type === "endSegment") {
|
|
1267
|
-
nt(e.captureId);
|
|
1268
|
-
return;
|
|
1269
|
-
}
|
|
1270
|
-
if (e.type === "updateOptions") {
|
|
1271
|
-
it(e.captureId, e.options).catch((r) => {
|
|
1272
|
-
g.warn(`Failed to update audio capture options: ${r}`), w(r, e.captureId);
|
|
1273
|
-
});
|
|
1274
|
-
return;
|
|
1275
|
-
}
|
|
1276
|
-
e.type === "dispose" && st().catch((r) => {
|
|
1277
|
-
g.warn(`Failed to dispose audio capture worker: ${r}`);
|
|
1278
|
-
});
|
|
1279
|
-
});
|