@vonage/media-processor 3.0.1-alpha.0 → 3.0.1-alpha.2
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
async function
|
|
1
|
+
async function ze() {
|
|
2
2
|
return new Promise(async (r, e) => {
|
|
3
|
-
await Y() || B() ? r() : e(
|
|
3
|
+
!K() && (await Y() || B()) ? r() : e(
|
|
4
4
|
"Your browser does not support the MediaStreamTrack API for Insertable Streams of Media."
|
|
5
5
|
);
|
|
6
6
|
});
|
|
@@ -19,6 +19,10 @@ function Z() {
|
|
|
19
19
|
self.AudioWorkletNode
|
|
20
20
|
].filter((r) => r === void 0).length === 0;
|
|
21
21
|
}
|
|
22
|
+
function K() {
|
|
23
|
+
const r = navigator.userAgent.toLowerCase();
|
|
24
|
+
return !(navigator.vendor && navigator.vendor.toLowerCase().indexOf("apple") > -1 && !(r.indexOf("applewebkit") > -1 && r.indexOf("version") === -1)) ? !1 : parseInt((r.split(" ").find((s) => s.includes("version/")) ?? "/0").split("/")[1]) < 26;
|
|
25
|
+
}
|
|
22
26
|
function Y() {
|
|
23
27
|
return new Promise((r) => {
|
|
24
28
|
function e() {
|
|
@@ -30,10 +34,10 @@ function Y() {
|
|
|
30
34
|
t.onmessage = ({ data: s }) => r(s);
|
|
31
35
|
});
|
|
32
36
|
}
|
|
33
|
-
const u = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(),
|
|
37
|
+
const u = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ Symbol("anyProducer"), D = Promise.resolve(), M = /* @__PURE__ */ Symbol("listenerAdded"), R = /* @__PURE__ */ Symbol("listenerRemoved");
|
|
34
38
|
let I = !1, F = !1;
|
|
35
39
|
const x = (r) => typeof r == "string" || typeof r == "symbol" || typeof r == "number";
|
|
36
|
-
function
|
|
40
|
+
function y(r) {
|
|
37
41
|
if (!x(r))
|
|
38
42
|
throw new TypeError("`eventName` must be a string, symbol, or number");
|
|
39
43
|
}
|
|
@@ -47,18 +51,18 @@ function _(r, e) {
|
|
|
47
51
|
return t.get(e);
|
|
48
52
|
}
|
|
49
53
|
function T(r, e) {
|
|
50
|
-
const t = x(e) ? e :
|
|
54
|
+
const t = x(e) ? e : P, s = d.get(r);
|
|
51
55
|
if (s.has(t))
|
|
52
56
|
return s.get(t);
|
|
53
57
|
}
|
|
54
|
-
function
|
|
58
|
+
function N(r, e, t) {
|
|
55
59
|
const s = d.get(r);
|
|
56
60
|
if (s.has(e))
|
|
57
61
|
for (const i of s.get(e))
|
|
58
62
|
i.enqueue(t);
|
|
59
|
-
if (s.has(
|
|
63
|
+
if (s.has(P)) {
|
|
60
64
|
const i = Promise.all([e, t]);
|
|
61
|
-
for (const n of s.get(
|
|
65
|
+
for (const n of s.get(P))
|
|
62
66
|
n.enqueue(i);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
@@ -158,7 +162,7 @@ class h {
|
|
|
158
162
|
F = e;
|
|
159
163
|
}
|
|
160
164
|
constructor(e = {}) {
|
|
161
|
-
u.set(this, /* @__PURE__ */ new Set()), m.set(this, /* @__PURE__ */ new Map()), d.set(this, /* @__PURE__ */ new Map()), d.get(this).set(
|
|
165
|
+
u.set(this, /* @__PURE__ */ new Set()), m.set(this, /* @__PURE__ */ new Map()), d.set(this, /* @__PURE__ */ new Map()), d.get(this).set(P, /* @__PURE__ */ new Set()), this.debug = e.debug ?? {}, this.debug.enabled === void 0 && (this.debug.enabled = !1), this.debug.logger || (this.debug.logger = (t, s, i, n) => {
|
|
162
166
|
try {
|
|
163
167
|
n = JSON.stringify(n);
|
|
164
168
|
} catch {
|
|
@@ -176,7 +180,7 @@ class h {
|
|
|
176
180
|
on(e, t, { signal: s } = {}) {
|
|
177
181
|
k(t), e = Array.isArray(e) ? e : [e];
|
|
178
182
|
for (const n of e) {
|
|
179
|
-
|
|
183
|
+
y(n);
|
|
180
184
|
let o = _(this, n);
|
|
181
185
|
o || (o = /* @__PURE__ */ new Set(), m.get(this).set(n, o)), o.add(t), this.logIfDebugEnabled("subscribe", n, void 0), b(n) || E(this, M, { eventName: n, listener: t });
|
|
182
186
|
}
|
|
@@ -188,7 +192,7 @@ class h {
|
|
|
188
192
|
off(e, t) {
|
|
189
193
|
k(t), e = Array.isArray(e) ? e : [e];
|
|
190
194
|
for (const s of e) {
|
|
191
|
-
|
|
195
|
+
y(s);
|
|
192
196
|
const i = _(this, s);
|
|
193
197
|
i && (i.delete(t), i.size === 0 && m.get(this).delete(s)), this.logIfDebugEnabled("unsubscribe", s, void 0), b(s) || E(this, R, { eventName: s, listener: t });
|
|
194
198
|
}
|
|
@@ -207,13 +211,13 @@ class h {
|
|
|
207
211
|
events(e) {
|
|
208
212
|
e = Array.isArray(e) ? e : [e];
|
|
209
213
|
for (const t of e)
|
|
210
|
-
|
|
214
|
+
y(t);
|
|
211
215
|
return V(this, e);
|
|
212
216
|
}
|
|
213
217
|
async emit(e, t) {
|
|
214
|
-
if (
|
|
218
|
+
if (y(e), b(e) && !I)
|
|
215
219
|
throw new TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");
|
|
216
|
-
this.logIfDebugEnabled("emit", e, t),
|
|
220
|
+
this.logIfDebugEnabled("emit", e, t), N(this, e, t);
|
|
217
221
|
const s = _(this, e) ?? /* @__PURE__ */ new Set(), i = u.get(this), n = [...s], o = b(e) ? [] : [...i];
|
|
218
222
|
await D, await Promise.all([
|
|
219
223
|
...n.map(async (a) => {
|
|
@@ -227,7 +231,7 @@ class h {
|
|
|
227
231
|
]);
|
|
228
232
|
}
|
|
229
233
|
async emitSerial(e, t) {
|
|
230
|
-
if (
|
|
234
|
+
if (y(e), b(e) && !I)
|
|
231
235
|
throw new TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");
|
|
232
236
|
this.logIfDebugEnabled("emitSerial", e, t);
|
|
233
237
|
const s = _(this, e) ?? /* @__PURE__ */ new Set(), i = u.get(this), n = [...s], o = [...i];
|
|
@@ -281,7 +285,7 @@ class h {
|
|
|
281
285
|
t += u.get(this).size + (_(this, s)?.size ?? 0) + (T(this, s)?.size ?? 0) + (T(this)?.size ?? 0);
|
|
282
286
|
continue;
|
|
283
287
|
}
|
|
284
|
-
s !== void 0 &&
|
|
288
|
+
s !== void 0 && y(s), t += u.get(this).size;
|
|
285
289
|
for (const i of m.get(this).values())
|
|
286
290
|
t += i.size;
|
|
287
291
|
for (const i of d.get(this).values())
|
|
@@ -316,37 +320,37 @@ Object.defineProperty(h, "listenerRemoved", {
|
|
|
316
320
|
enumerable: !0,
|
|
317
321
|
configurable: !1
|
|
318
322
|
});
|
|
319
|
-
var
|
|
320
|
-
const
|
|
323
|
+
var ee = Object.defineProperty, te = (r, e, t) => e in r ? ee(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, re = (r, e, t) => (te(r, e + "", t), t), se = /* @__PURE__ */ ((r) => (r.automation = "automation", r.test = "test", r.vbc = "vbc", r.video = "video", r.voice = "voice", r))(se || {});
|
|
324
|
+
const ie = "hlg.tokbox.com/prod/logging/vcp_webrtc", ne = "https://", oe = 1e4;
|
|
321
325
|
let v;
|
|
322
|
-
const
|
|
323
|
-
function
|
|
326
|
+
const ae = new Uint8Array(16);
|
|
327
|
+
function ce() {
|
|
324
328
|
if (!v && (v = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !v))
|
|
325
329
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
326
|
-
return v(
|
|
330
|
+
return v(ae);
|
|
327
331
|
}
|
|
328
332
|
const c = [];
|
|
329
333
|
for (let r = 0; r < 256; ++r)
|
|
330
334
|
c.push((r + 256).toString(16).slice(1));
|
|
331
|
-
function
|
|
335
|
+
function le(r, e = 0) {
|
|
332
336
|
return (c[r[e + 0]] + c[r[e + 1]] + c[r[e + 2]] + c[r[e + 3]] + "-" + c[r[e + 4]] + c[r[e + 5]] + "-" + c[r[e + 6]] + c[r[e + 7]] + "-" + c[r[e + 8]] + c[r[e + 9]] + "-" + c[r[e + 10]] + c[r[e + 11]] + c[r[e + 12]] + c[r[e + 13]] + c[r[e + 14]] + c[r[e + 15]]).toLowerCase();
|
|
333
337
|
}
|
|
334
|
-
const
|
|
335
|
-
randomUUID:
|
|
338
|
+
const de = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Q = {
|
|
339
|
+
randomUUID: de
|
|
336
340
|
};
|
|
337
|
-
function
|
|
341
|
+
function fe(r, e, t) {
|
|
338
342
|
if (Q.randomUUID && !r)
|
|
339
343
|
return Q.randomUUID();
|
|
340
344
|
r = r || {};
|
|
341
|
-
const s = r.random || (r.rng ||
|
|
342
|
-
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128,
|
|
345
|
+
const s = r.random || (r.rng || ce)();
|
|
346
|
+
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, le(s);
|
|
343
347
|
}
|
|
344
|
-
function
|
|
348
|
+
function $(r, e) {
|
|
345
349
|
globalThis.vonage || (globalThis.vonage = {}), globalThis.vonage.workerizer || (globalThis.vonage.workerizer = {});
|
|
346
350
|
let t = globalThis.vonage.workerizer;
|
|
347
351
|
return t[r] || (t[r] = e), t[r];
|
|
348
352
|
}
|
|
349
|
-
const p =
|
|
353
|
+
const p = $(
|
|
350
354
|
"globals",
|
|
351
355
|
{}
|
|
352
356
|
);
|
|
@@ -354,9 +358,9 @@ var g = /* @__PURE__ */ ((r) => (r.INIT = "INIT", r.FORWARD = "FORWARD", r.TERMI
|
|
|
354
358
|
function J(r) {
|
|
355
359
|
return [ImageBitmap, ReadableStream, WritableStream].some((t) => r instanceof t);
|
|
356
360
|
}
|
|
357
|
-
let
|
|
358
|
-
function
|
|
359
|
-
const n =
|
|
361
|
+
let he = 0;
|
|
362
|
+
function ue(r, e, t, s, i) {
|
|
363
|
+
const n = he++;
|
|
360
364
|
return r.postMessage(
|
|
361
365
|
{
|
|
362
366
|
id: n,
|
|
@@ -380,11 +384,11 @@ function S(r, e) {
|
|
|
380
384
|
i.filter((n) => J(n))
|
|
381
385
|
);
|
|
382
386
|
}
|
|
383
|
-
const q =
|
|
387
|
+
const q = $("workerized", {});
|
|
384
388
|
function X() {
|
|
385
389
|
return typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope;
|
|
386
390
|
}
|
|
387
|
-
async function
|
|
391
|
+
async function pe() {
|
|
388
392
|
if (X())
|
|
389
393
|
S({ type: g.GLOBALS_SYNC }, p);
|
|
390
394
|
else {
|
|
@@ -392,7 +396,7 @@ async function ue() {
|
|
|
392
396
|
for (const e in q) {
|
|
393
397
|
const { worker: t, resolvers: s } = q[e].workerContext;
|
|
394
398
|
t && r.push(
|
|
395
|
-
|
|
399
|
+
ue(
|
|
396
400
|
t,
|
|
397
401
|
g.GLOBALS_SYNC,
|
|
398
402
|
"",
|
|
@@ -413,7 +417,7 @@ function C(r, e) {
|
|
|
413
417
|
for (const t in r)
|
|
414
418
|
Array.isArray(r[t]) ? (e[t] = [], C(r[t], e[t])) : typeof r[t] == "object" ? (e[t] = {}, C(r[t], e[t])) : e[t] = r[t];
|
|
415
419
|
}
|
|
416
|
-
async function
|
|
420
|
+
async function me(r, e) {
|
|
417
421
|
const { functionName: t, args: s } = r;
|
|
418
422
|
if (!e.instance)
|
|
419
423
|
throw "instance not initialized";
|
|
@@ -423,11 +427,11 @@ async function pe(r, e) {
|
|
|
423
427
|
throw `undefined function [${t}] in class ${e.instance.constructor.workerId}`;
|
|
424
428
|
S(r, await e.instance[t](...s ?? []));
|
|
425
429
|
}
|
|
426
|
-
const
|
|
427
|
-
function
|
|
430
|
+
const ge = $("registeredWorkers", {});
|
|
431
|
+
function we(r, e) {
|
|
428
432
|
if (!r.args)
|
|
429
433
|
throw "Missing className while initializing worker";
|
|
430
|
-
const [t, s] = r.args, i =
|
|
434
|
+
const [t, s] = r.args, i = ge[t];
|
|
431
435
|
if (i)
|
|
432
436
|
e.instance = new i(r.args.slice(1));
|
|
433
437
|
else
|
|
@@ -441,60 +445,60 @@ async function ye(r, e) {
|
|
|
441
445
|
let s;
|
|
442
446
|
e.instance.terminate && (s = await e.instance.terminate(...t ?? [])), S(r, s);
|
|
443
447
|
}
|
|
444
|
-
function
|
|
448
|
+
function _e(r) {
|
|
445
449
|
if (!r.args)
|
|
446
450
|
throw "Missing globals while syncing";
|
|
447
451
|
C(r.args[0], p), S(r, {});
|
|
448
452
|
}
|
|
449
|
-
function
|
|
453
|
+
function be() {
|
|
450
454
|
const r = {};
|
|
451
455
|
onmessage = async (e) => {
|
|
452
456
|
const t = e.data;
|
|
453
457
|
switch (t.type) {
|
|
454
458
|
case g.INIT:
|
|
455
|
-
|
|
459
|
+
we(t, r);
|
|
456
460
|
break;
|
|
457
461
|
case g.FORWARD:
|
|
458
|
-
|
|
462
|
+
me(t, r);
|
|
459
463
|
break;
|
|
460
464
|
case g.TERMINATE:
|
|
461
465
|
ye(t, r);
|
|
462
466
|
break;
|
|
463
467
|
case g.GLOBALS_SYNC:
|
|
464
|
-
|
|
468
|
+
_e(t);
|
|
465
469
|
break;
|
|
466
470
|
}
|
|
467
471
|
};
|
|
468
472
|
}
|
|
469
|
-
X() &&
|
|
470
|
-
function
|
|
473
|
+
X() && be();
|
|
474
|
+
function Te(r, e) {
|
|
471
475
|
return p[r] || (p[r] = e), [
|
|
472
476
|
() => p[r],
|
|
473
477
|
async (t) => {
|
|
474
|
-
p[r] = t, await
|
|
478
|
+
p[r] = t, await pe();
|
|
475
479
|
}
|
|
476
480
|
];
|
|
477
481
|
}
|
|
478
|
-
function
|
|
479
|
-
return
|
|
482
|
+
function Se(r, e) {
|
|
483
|
+
return Te(r, e);
|
|
480
484
|
}
|
|
481
|
-
const [
|
|
482
|
-
function
|
|
483
|
-
|
|
485
|
+
const [ke, Ee] = Se("metadata");
|
|
486
|
+
function De(r) {
|
|
487
|
+
Ee(r);
|
|
484
488
|
}
|
|
485
489
|
function L() {
|
|
486
|
-
return
|
|
490
|
+
return ke();
|
|
487
491
|
}
|
|
488
492
|
class z {
|
|
489
493
|
constructor(e, t) {
|
|
490
|
-
|
|
494
|
+
re(this, "uuid"), this.config = e, this.uuid = t ?? fe();
|
|
491
495
|
}
|
|
492
496
|
async send(e) {
|
|
493
497
|
var t, s, i;
|
|
494
498
|
const { appId: n, sourceType: o } = (t = L()) != null ? t : {};
|
|
495
499
|
if (!n || !o)
|
|
496
500
|
return "metadata missing";
|
|
497
|
-
const a = new AbortController(), l = setTimeout(() => a.abort(),
|
|
501
|
+
const a = new AbortController(), l = setTimeout(() => a.abort(), oe);
|
|
498
502
|
return await ((i = (s = this.config) == null ? void 0 : s.fetch) != null ? i : fetch)(this.getUrl(), {
|
|
499
503
|
method: "POST",
|
|
500
504
|
headers: this.getHeaders(),
|
|
@@ -504,8 +508,8 @@ class z {
|
|
|
504
508
|
}
|
|
505
509
|
getUrl() {
|
|
506
510
|
var e;
|
|
507
|
-
let t = (e = L().proxyUrl) != null ? e :
|
|
508
|
-
return t += (t.at(-1) === "/" ? "" : "/") +
|
|
511
|
+
let t = (e = L().proxyUrl) != null ? e : ne;
|
|
512
|
+
return t += (t.at(-1) === "/" ? "" : "/") + ie, t;
|
|
509
513
|
}
|
|
510
514
|
getHeaders() {
|
|
511
515
|
return {
|
|
@@ -524,7 +528,7 @@ class z {
|
|
|
524
528
|
};
|
|
525
529
|
}
|
|
526
530
|
}
|
|
527
|
-
const
|
|
531
|
+
const A = "3.0.1-alpha.2", O = class O {
|
|
528
532
|
};
|
|
529
533
|
O.updates = {
|
|
530
534
|
transformer_new: "New transformer",
|
|
@@ -538,11 +542,11 @@ O.updates = {
|
|
|
538
542
|
writable_null: "Writable is null"
|
|
539
543
|
};
|
|
540
544
|
let f = O;
|
|
541
|
-
function
|
|
545
|
+
function ve(r) {
|
|
542
546
|
return typeof r == "object" && r !== null && "message" in r && typeof r.message == "string";
|
|
543
547
|
}
|
|
544
|
-
function
|
|
545
|
-
if (
|
|
548
|
+
function Ae(r) {
|
|
549
|
+
if (ve(r)) return r;
|
|
546
550
|
try {
|
|
547
551
|
return new Error(JSON.stringify(r));
|
|
548
552
|
} catch {
|
|
@@ -550,7 +554,7 @@ function ve(r) {
|
|
|
550
554
|
}
|
|
551
555
|
}
|
|
552
556
|
function G(r) {
|
|
553
|
-
return
|
|
557
|
+
return Ae(r).message;
|
|
554
558
|
}
|
|
555
559
|
class Pe {
|
|
556
560
|
constructor(e, t) {
|
|
@@ -565,25 +569,25 @@ class Pe {
|
|
|
565
569
|
}
|
|
566
570
|
async onFrameTransformed(e = {}, t = !1) {
|
|
567
571
|
this.startAt === 0 && (this.startAt = Date.now()), this.frameTransformedCount++;
|
|
568
|
-
const { startAt: s, frameTransformedCount: i, frameFromSourceCount: n } = this, o = Date.now(), a = (o - s) / 1e3, l = i / a,
|
|
572
|
+
const { startAt: s, frameTransformedCount: i, frameFromSourceCount: n } = this, o = Date.now(), a = (o - s) / 1e3, l = i / a, w = n / a;
|
|
569
573
|
return t || this.frameTransformedCount >= this.config.loggingIntervalFrameCount ? (this.frameFromSourceCount = 0, this.frameTransformedCount = 0, this.startAt = o, this.reporter.config = this.config, this.reporter.send({
|
|
570
574
|
...this.config.report,
|
|
571
575
|
variation: "QoS",
|
|
572
|
-
fps:
|
|
576
|
+
fps: w,
|
|
573
577
|
transformedFps: l,
|
|
574
578
|
framesTransformed: i,
|
|
575
579
|
...e
|
|
576
580
|
})) : "success";
|
|
577
581
|
}
|
|
578
582
|
}
|
|
579
|
-
var
|
|
580
|
-
const
|
|
581
|
-
class
|
|
583
|
+
var Me = /* @__PURE__ */ ((r) => (r.FPS_DROP = "fps_drop", r))(Me || {}), Re = /* @__PURE__ */ ((r) => (r.start = "start", r.transform = "transform", r.flush = "flush", r))(Re || {}), U = /* @__PURE__ */ ((r) => (r.pipeline_ended = "pipeline_ended", r.pipeline_ended_with_error = "pipeline_ended_with_error", r.pipeline_started = "pipeline_started", r.pipeline_started_with_error = "pipeline_started_with_error", r.pipeline_restarted = "pipeline_restarted", r.pipeline_restarted_with_error = "pipeline_restarted_with_error", r))(U || {});
|
|
584
|
+
const Ie = 500, xe = 0.8;
|
|
585
|
+
class Ce extends h {
|
|
582
586
|
constructor(e, t) {
|
|
583
587
|
super(), this.reporter_ = new z(), this.reporterQos_ = new Pe({
|
|
584
|
-
loggingIntervalFrameCount:
|
|
588
|
+
loggingIntervalFrameCount: Ie,
|
|
585
589
|
report: {
|
|
586
|
-
version:
|
|
590
|
+
version: A
|
|
587
591
|
}
|
|
588
592
|
}), this.index_ = t, this.transformer_ = e, this.shouldStop_ = !1, this.isFlashed_ = !1, this.mediaTransformerQosReportStartTimestamp_ = 0, this.videoHeight_ = 0, this.videoWidth_ = 0, this.trackExpectedRate_ = -1, this.transformerType_ = "Custom", "getTransformerType" in e && (this.transformerType_ = e.getTransformerType()), this.report({
|
|
589
593
|
variation: "Create"
|
|
@@ -632,7 +636,7 @@ class xe extends h {
|
|
|
632
636
|
};
|
|
633
637
|
this.emit("error", i);
|
|
634
638
|
}
|
|
635
|
-
if (this.trackExpectedRate_ != -1 && this.trackExpectedRate_ *
|
|
639
|
+
if (this.trackExpectedRate_ != -1 && this.trackExpectedRate_ * xe > this.reporterQos_.fps) {
|
|
636
640
|
const s = {
|
|
637
641
|
eventMetaData: {
|
|
638
642
|
transformerIndex: this.index_
|
|
@@ -676,7 +680,7 @@ class xe extends h {
|
|
|
676
680
|
}
|
|
677
681
|
report(e) {
|
|
678
682
|
this.reporter_.send({
|
|
679
|
-
version:
|
|
683
|
+
version: A,
|
|
680
684
|
action: "MediaTransformer",
|
|
681
685
|
transformerType: this.transformerType_,
|
|
682
686
|
...e
|
|
@@ -687,7 +691,7 @@ class xe extends h {
|
|
|
687
691
|
...this.reporterQos_.config
|
|
688
692
|
}, this.reporterQos_.onFrameTransformed(
|
|
689
693
|
{
|
|
690
|
-
version:
|
|
694
|
+
version: A,
|
|
691
695
|
action: "MediaTransformer",
|
|
692
696
|
transformerType: this.transformerType_,
|
|
693
697
|
videoWidth: this.videoWidth_,
|
|
@@ -697,11 +701,11 @@ class xe extends h {
|
|
|
697
701
|
);
|
|
698
702
|
}
|
|
699
703
|
}
|
|
700
|
-
class
|
|
704
|
+
class Oe extends h {
|
|
701
705
|
constructor(e) {
|
|
702
706
|
super(), this.transformers_ = [], this.trackExpectedRate_ = -1;
|
|
703
707
|
for (let t = 0; t < e.length; t++) {
|
|
704
|
-
let s = new
|
|
708
|
+
let s = new Ce(e[t], t);
|
|
705
709
|
s.on("error", (i) => {
|
|
706
710
|
this.emit("error", i);
|
|
707
711
|
}), s.on("warn", (i) => {
|
|
@@ -767,7 +771,7 @@ class Ce extends h {
|
|
|
767
771
|
e.stop();
|
|
768
772
|
}
|
|
769
773
|
}
|
|
770
|
-
class
|
|
774
|
+
class We extends h {
|
|
771
775
|
constructor() {
|
|
772
776
|
super(), this.reporter_ = new z(), this.trackExpectedRate_ = -1, this.report({
|
|
773
777
|
variation: "Create"
|
|
@@ -825,12 +829,12 @@ class Oe extends h {
|
|
|
825
829
|
return;
|
|
826
830
|
}
|
|
827
831
|
let s = !1;
|
|
828
|
-
this.pipeline_ && (s = !0, this.pipeline_.clearListeners(), this.pipeline_.destroy()), this.pipeline_ = new
|
|
832
|
+
this.pipeline_ && (s = !0, this.pipeline_.clearListeners(), this.pipeline_.destroy()), this.pipeline_ = new Oe(this.transformers_), this.pipeline_.on("warn", (i) => {
|
|
829
833
|
this.emit("warn", i);
|
|
830
834
|
}), this.pipeline_.on("error", (i) => {
|
|
831
835
|
this.emit("error", i);
|
|
832
836
|
}), this.pipeline_.on("pipelineInfo", (i) => {
|
|
833
|
-
s && (i === "pipeline_started" ? i =
|
|
837
|
+
s && (i === "pipeline_started" ? i = U.pipeline_restarted : i === "pipeline_started_with_error" && (i = U.pipeline_restarted_with_error)), this.emit("pipelineInfo", i);
|
|
834
838
|
}), this.trackExpectedRate_ != -1 && this.pipeline_.setTrackExpectedRate(this.trackExpectedRate_), this.pipeline_.start(this.readable_, this.writable_).then(() => {
|
|
835
839
|
e();
|
|
836
840
|
}).catch((i) => {
|
|
@@ -863,7 +867,7 @@ class Oe extends h {
|
|
|
863
867
|
}
|
|
864
868
|
report(e) {
|
|
865
869
|
this.reporter_.send({
|
|
866
|
-
version:
|
|
870
|
+
version: A,
|
|
867
871
|
action: "MediaProcessor",
|
|
868
872
|
...e
|
|
869
873
|
});
|
|
@@ -872,7 +876,7 @@ class Oe extends h {
|
|
|
872
876
|
return "kind" in e;
|
|
873
877
|
}
|
|
874
878
|
}
|
|
875
|
-
class
|
|
879
|
+
class Fe {
|
|
876
880
|
constructor({ kind: e }) {
|
|
877
881
|
if (e == "video") {
|
|
878
882
|
const t = document.createElement("canvas"), s = t.getContext("2d", {
|
|
@@ -895,9 +899,9 @@ class We {
|
|
|
895
899
|
constructor() {
|
|
896
900
|
super(), this.arrays = [], this.arrayOffset = 0, this.port.onmessage = ({ data: l }) => this.arrays.push(l), this.emptyArray = new Float32Array(0);
|
|
897
901
|
}
|
|
898
|
-
process(l, [[
|
|
899
|
-
for (let W = 0; W <
|
|
900
|
-
(!this.array || this.arrayOffset >= this.array.length) && (this.array = this.arrays.shift() || this.emptyArray, this.arrayOffset = 0),
|
|
902
|
+
process(l, [[w]]) {
|
|
903
|
+
for (let W = 0; W < w.length; W++)
|
|
904
|
+
(!this.array || this.arrayOffset >= this.array.length) && (this.array = this.arrays.shift() || this.emptyArray, this.arrayOffset = 0), w[W] = this.array[this.arrayOffset++] || 0;
|
|
901
905
|
return !0;
|
|
902
906
|
}
|
|
903
907
|
}
|
|
@@ -917,10 +921,10 @@ class We {
|
|
|
917
921
|
}
|
|
918
922
|
}
|
|
919
923
|
}
|
|
920
|
-
function
|
|
921
|
-
return self.MediaStreamTrackGenerator ? self.MediaStreamTrackGenerator :
|
|
924
|
+
function Le() {
|
|
925
|
+
return self.MediaStreamTrackGenerator ? self.MediaStreamTrackGenerator : Fe;
|
|
922
926
|
}
|
|
923
|
-
class
|
|
927
|
+
class Ge {
|
|
924
928
|
constructor(e) {
|
|
925
929
|
const t = e.track ?? e;
|
|
926
930
|
t.kind == "video" ? this.readable = new ReadableStream({
|
|
@@ -1007,8 +1011,8 @@ class Le {
|
|
|
1007
1011
|
}));
|
|
1008
1012
|
}
|
|
1009
1013
|
}
|
|
1010
|
-
function
|
|
1011
|
-
return self.MediaStreamTrackProcessor ? self.MediaStreamTrackProcessor :
|
|
1014
|
+
function Ue() {
|
|
1015
|
+
return self.MediaStreamTrackProcessor ? self.MediaStreamTrackProcessor : Ge;
|
|
1012
1016
|
}
|
|
1013
1017
|
class $e {
|
|
1014
1018
|
constructor() {
|
|
@@ -1017,7 +1021,7 @@ class $e {
|
|
|
1017
1021
|
init(e) {
|
|
1018
1022
|
return new Promise((t, s) => {
|
|
1019
1023
|
try {
|
|
1020
|
-
const i =
|
|
1024
|
+
const i = Ue();
|
|
1021
1025
|
this.processor_ = new i(e);
|
|
1022
1026
|
} catch (i) {
|
|
1023
1027
|
console.log(
|
|
@@ -1025,7 +1029,7 @@ class $e {
|
|
|
1025
1029
|
), s(i);
|
|
1026
1030
|
}
|
|
1027
1031
|
try {
|
|
1028
|
-
const i =
|
|
1032
|
+
const i = Le();
|
|
1029
1033
|
e.kind === "audio" ? this.generator_ = new i({
|
|
1030
1034
|
kind: "audio"
|
|
1031
1035
|
}) : e.kind === "video" ? this.generator_ = new i({
|
|
@@ -1049,7 +1053,7 @@ class $e {
|
|
|
1049
1053
|
return this.generator_;
|
|
1050
1054
|
}
|
|
1051
1055
|
}
|
|
1052
|
-
class
|
|
1056
|
+
class He {
|
|
1053
1057
|
/**
|
|
1054
1058
|
* - When running insertable streams on the main `MediaProcessorInterface` should be instance of `MediaProcessor` class.
|
|
1055
1059
|
* - When running insertable streams on WebWorker `MediaProcessorInterface` should be instance of bridge calss created by the user. Example can be found [here](/docs/intro.md#using-the-transformer-on-webworker)
|
|
@@ -1066,7 +1070,7 @@ class je {
|
|
|
1066
1070
|
* @returns New track to be used.
|
|
1067
1071
|
*/
|
|
1068
1072
|
async setTrack(e) {
|
|
1069
|
-
if (!(this.mediaProcessor_ instanceof
|
|
1073
|
+
if (!(this.mediaProcessor_ instanceof We) && await Y()) {
|
|
1070
1074
|
if (e.kind === "audio")
|
|
1071
1075
|
throw Error("Cannot process audio tracks inside a web worker when passing a track to transform");
|
|
1072
1076
|
return await this.mediaProcessor_.transform(e);
|
|
@@ -1094,13 +1098,13 @@ class je {
|
|
|
1094
1098
|
}
|
|
1095
1099
|
}
|
|
1096
1100
|
export {
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1101
|
+
Re as ErrorFunction,
|
|
1102
|
+
We as MediaProcessor,
|
|
1103
|
+
He as MediaProcessorConnector,
|
|
1104
|
+
U as PipelineInfoData,
|
|
1105
|
+
se as VonageSourceType,
|
|
1106
|
+
Me as WarningType,
|
|
1103
1107
|
L as getVonageMetadata,
|
|
1104
|
-
|
|
1105
|
-
|
|
1108
|
+
ze as isSupported,
|
|
1109
|
+
De as setVonageMetadata
|
|
1106
1110
|
};
|