@vindral/web-sdk 4.0.0-192-g3adea82c → 4.0.0-92-g740c26fd
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/{Bjw91YDL.js → BQG9yEzp.js} +1036 -1004
- package/BRoNEXvE.js +4426 -0
- package/{BTxJOjm9.js → Bx7s5QdT.js} +3 -0
- package/{CLbtlm7F.js → Ddff6fHr.js} +1 -1
- package/{CbAhEyCB.js → DsS-0pTK.js} +1 -1
- package/{F-U5JXpv.js → OtzuLqy6.js} +52 -49
- package/api-client.d.ts +19 -7
- package/api-client.js +1 -1
- package/cast-sender.d.ts +20 -6
- package/cast-sender.js +2 -2
- package/core.d.ts +127 -79
- package/core.js +4 -5
- package/legacy.d.ts +131 -83
- package/legacy.es.js +5393 -5241
- package/legacy.umd.js +9 -9
- package/package.json +1 -1
- package/player.d.ts +88 -70
- package/player.js +1057 -1002
- package/B5HbyMuu.js +0 -4311
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var wn = Object.defineProperty, Sn = Object.defineProperties;
|
|
2
|
+
var vn = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var ss = Object.getOwnPropertySymbols;
|
|
4
|
+
var bn = Object.prototype.hasOwnProperty, yn = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ns = (i) => {
|
|
6
6
|
throw TypeError(i);
|
|
7
7
|
};
|
|
8
|
-
var
|
|
8
|
+
var bi = (i, e, t) => e in i ? wn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, A = (i, e) => {
|
|
9
9
|
for (var t in e || (e = {}))
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
for (var t of
|
|
13
|
-
|
|
10
|
+
bn.call(e, t) && bi(i, t, e[t]);
|
|
11
|
+
if (ss)
|
|
12
|
+
for (var t of ss(e))
|
|
13
|
+
yn.call(e, t) && bi(i, t, e[t]);
|
|
14
14
|
return i;
|
|
15
|
-
},
|
|
16
|
-
var n = (i, e, t) =>
|
|
17
|
-
var d = (i, e, t) => (
|
|
15
|
+
}, L = (i, e) => Sn(i, vn(e));
|
|
16
|
+
var n = (i, e, t) => bi(i, typeof e != "symbol" ? e + "" : e, t), yi = (i, e, t) => e.has(i) || ns("Cannot " + t);
|
|
17
|
+
var d = (i, e, t) => (yi(i, e, "read from private field"), t ? t.call(i) : e.get(i)), w = (i, e, t) => e.has(i) ? ns("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), S = (i, e, t, s) => (yi(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t), F = (i, e, t) => (yi(i, e, "access private method"), t);
|
|
18
18
|
var mt = (i, e, t, s) => ({
|
|
19
19
|
set _(r) {
|
|
20
|
-
|
|
20
|
+
S(i, e, r, t);
|
|
21
21
|
},
|
|
22
22
|
get _() {
|
|
23
23
|
return d(i, e, s);
|
|
@@ -39,9 +39,9 @@ var y = (i, e, t) => new Promise((s, r) => {
|
|
|
39
39
|
}, c = (h) => h.done ? s(h.value) : Promise.resolve(h.value).then(o, a);
|
|
40
40
|
c((t = t.apply(i, e)).next());
|
|
41
41
|
});
|
|
42
|
-
import { E as Pe } from "./
|
|
43
|
-
import { a as ae, A as
|
|
44
|
-
class
|
|
42
|
+
import { E as Pe } from "./Bx7s5QdT.js";
|
|
43
|
+
import { a as ae, A as En, b as Tn, i as Cn, p as In, t as Bn, d as Rn } from "./OtzuLqy6.js";
|
|
44
|
+
class rs {
|
|
45
45
|
constructor(e) {
|
|
46
46
|
n(this, "maxSize", 0);
|
|
47
47
|
n(this, "size", 0);
|
|
@@ -75,7 +75,7 @@ class ns {
|
|
|
75
75
|
return this._borrowedBuffers;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
class
|
|
78
|
+
class St {
|
|
79
79
|
constructor() {
|
|
80
80
|
/**
|
|
81
81
|
* A promise that resolves when the deferred value is resolved
|
|
@@ -106,11 +106,11 @@ class wt {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
static resolved(e) {
|
|
109
|
-
const t = new
|
|
109
|
+
const t = new St();
|
|
110
110
|
return t.resolve(e), t;
|
|
111
111
|
}
|
|
112
112
|
static fromPromise(e) {
|
|
113
|
-
const t = new
|
|
113
|
+
const t = new St();
|
|
114
114
|
return t.promise = e, e.then(
|
|
115
115
|
(s) => {
|
|
116
116
|
t.pending = !1, t.resolved = s;
|
|
@@ -121,7 +121,7 @@ class wt {
|
|
|
121
121
|
), t;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class J {
|
|
125
125
|
constructor(e = 50) {
|
|
126
126
|
n(this, "maxSize");
|
|
127
127
|
n(this, "values", []);
|
|
@@ -144,7 +144,7 @@ class Z {
|
|
|
144
144
|
}
|
|
145
145
|
const le = () => {
|
|
146
146
|
};
|
|
147
|
-
class
|
|
147
|
+
class Ns {
|
|
148
148
|
constructor(e, t = 0) {
|
|
149
149
|
n(this, "buffer");
|
|
150
150
|
n(this, "bytes");
|
|
@@ -183,13 +183,13 @@ function vt() {
|
|
|
183
183
|
const i = self.MediaSource, e = self.ManagedMediaSource;
|
|
184
184
|
return i != null ? i : e;
|
|
185
185
|
}
|
|
186
|
-
const
|
|
186
|
+
const kn = new RegExp(
|
|
187
187
|
"(android|bbd+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/",
|
|
188
188
|
"i"
|
|
189
|
-
), K = navigator.userAgent.toLowerCase(),
|
|
189
|
+
), K = navigator.userAgent.toLowerCase(), Pn = kn.test(K), xn = () => {
|
|
190
190
|
const i = document.createElement("video");
|
|
191
191
|
return i.canPlayType("application/vnd.apple.mpegURL") !== "" || i.canPlayType("audio/mpegurl") !== "";
|
|
192
|
-
},
|
|
192
|
+
}, Un = () => {
|
|
193
193
|
try {
|
|
194
194
|
if (typeof WebAssembly == "object" && typeof WebAssembly.instantiate == "function") {
|
|
195
195
|
const i = new WebAssembly.Module(Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0));
|
|
@@ -199,33 +199,33 @@ const Bn = new RegExp(
|
|
|
199
199
|
return !1;
|
|
200
200
|
}
|
|
201
201
|
return !1;
|
|
202
|
-
},
|
|
202
|
+
}, Ln = () => K.indexOf("CrKey") !== -1, Vs = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints === 0, pi = () => navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, Mn = () => K.indexOf("iphone") >= 0 && K.indexOf("like iphone") < 0 || K.indexOf("ipad") >= 0 && K.indexOf("like ipad") < 0 || K.indexOf("ipod") >= 0 && K.indexOf("like ipod") < 0 || pi(), _n = () => {
|
|
203
203
|
var i, e;
|
|
204
|
-
return
|
|
205
|
-
},
|
|
206
|
-
function
|
|
204
|
+
return pi() ? !1 : (e = (i = vt()) == null ? void 0 : i.isTypeSupported('audio/mp4; codecs="opus"')) != null ? e : !1;
|
|
205
|
+
}, Ya = () => "ontouchstart" in window || navigator.maxTouchPoints > 0, Ka = () => /^(?!.*chrome).*safari/i.test(K);
|
|
206
|
+
function Dn() {
|
|
207
207
|
var i, e;
|
|
208
208
|
if (/(iPhone|iPod|iPad)/i.test(K))
|
|
209
209
|
return (e = (i = K == null ? void 0 : K.match(/OS [\d_]+/i)) == null ? void 0 : i[0]) == null ? void 0 : e.substring(3).split("_").map((t) => parseInt(t))[0];
|
|
210
210
|
}
|
|
211
|
-
const
|
|
211
|
+
const On = () => {
|
|
212
212
|
var t;
|
|
213
213
|
const i = !!vt();
|
|
214
214
|
let e = !1;
|
|
215
|
-
return i && (e =
|
|
216
|
-
isMobile:
|
|
215
|
+
return i && (e = _n()), {
|
|
216
|
+
isMobile: Pn,
|
|
217
217
|
supportsMp4Opus: e,
|
|
218
218
|
supportsMediaSource: i,
|
|
219
|
-
supportsHls:
|
|
220
|
-
supportsWebAssembly:
|
|
219
|
+
supportsHls: xn(),
|
|
220
|
+
supportsWebAssembly: Un(),
|
|
221
221
|
platform: {
|
|
222
|
-
iosVersion: (t =
|
|
223
|
-
isIpadOS:
|
|
224
|
-
isMacOS:
|
|
225
|
-
isIOS:
|
|
222
|
+
iosVersion: (t = Dn()) != null ? t : Number.MAX_SAFE_INTEGER,
|
|
223
|
+
isIpadOS: pi(),
|
|
224
|
+
isMacOS: Vs(),
|
|
225
|
+
isIOS: Mn()
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
|
-
},
|
|
228
|
+
}, zs = (i, e, t) => {
|
|
229
229
|
let s = 0;
|
|
230
230
|
for (let r = e; r <= t; r++)
|
|
231
231
|
if (r === e) {
|
|
@@ -235,49 +235,49 @@ const _n = () => {
|
|
|
235
235
|
s = s * 256 + i[r];
|
|
236
236
|
return s;
|
|
237
237
|
};
|
|
238
|
-
var
|
|
239
|
-
class
|
|
238
|
+
var z, Ae, ye;
|
|
239
|
+
class os {
|
|
240
240
|
constructor(e) {
|
|
241
|
-
w(this,
|
|
242
|
-
w(this,
|
|
241
|
+
w(this, z);
|
|
242
|
+
w(this, Ae);
|
|
243
243
|
w(this, ye);
|
|
244
|
-
|
|
244
|
+
S(this, Ae, e), S(this, ye, new DataView(e.buffer, e.byteOffset, e.byteLength)), S(this, z, 0);
|
|
245
245
|
}
|
|
246
246
|
position() {
|
|
247
|
-
return d(this,
|
|
247
|
+
return d(this, z);
|
|
248
248
|
}
|
|
249
249
|
byteOffset() {
|
|
250
|
-
return d(this,
|
|
250
|
+
return d(this, Ae).byteOffset + d(this, z);
|
|
251
251
|
}
|
|
252
252
|
buffer() {
|
|
253
|
-
return d(this,
|
|
253
|
+
return d(this, Ae);
|
|
254
254
|
}
|
|
255
255
|
remaining() {
|
|
256
|
-
return d(this,
|
|
256
|
+
return d(this, Ae).length - d(this, z);
|
|
257
257
|
}
|
|
258
258
|
readUint8() {
|
|
259
|
-
const e = d(this, ye).getUint8(d(this,
|
|
260
|
-
return
|
|
259
|
+
const e = d(this, ye).getUint8(d(this, z));
|
|
260
|
+
return S(this, z, d(this, z) + 1), e;
|
|
261
261
|
}
|
|
262
262
|
readUint24() {
|
|
263
|
-
const e = d(this, ye).getUint32(d(this,
|
|
264
|
-
return
|
|
263
|
+
const e = d(this, ye).getUint32(d(this, z)) >> 8 & 16777215;
|
|
264
|
+
return S(this, z, d(this, z) + 3), e;
|
|
265
265
|
}
|
|
266
266
|
readUint16() {
|
|
267
|
-
const e = d(this, ye).getUint16(d(this,
|
|
268
|
-
return
|
|
267
|
+
const e = d(this, ye).getUint16(d(this, z));
|
|
268
|
+
return S(this, z, d(this, z) + 2), e;
|
|
269
269
|
}
|
|
270
270
|
readUint32() {
|
|
271
|
-
const e = d(this, ye).getUint32(d(this,
|
|
272
|
-
return
|
|
271
|
+
const e = d(this, ye).getUint32(d(this, z));
|
|
272
|
+
return S(this, z, d(this, z) + 4), e;
|
|
273
273
|
}
|
|
274
274
|
readUint64() {
|
|
275
|
-
const e =
|
|
276
|
-
return
|
|
275
|
+
const e = zs(d(this, Ae), d(this, z), d(this, z) + 7);
|
|
276
|
+
return S(this, z, d(this, z) + 8), e;
|
|
277
277
|
}
|
|
278
278
|
readBytes(e) {
|
|
279
|
-
const t = d(this,
|
|
280
|
-
return
|
|
279
|
+
const t = d(this, Ae).subarray(d(this, z), d(this, z) + e);
|
|
280
|
+
return S(this, z, d(this, z) + e), t;
|
|
281
281
|
}
|
|
282
282
|
readRemaining() {
|
|
283
283
|
return this.readBytes(this.remaining());
|
|
@@ -290,8 +290,8 @@ class rs {
|
|
|
290
290
|
return new TextDecoder().decode(new Uint8Array(e));
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
|
|
294
|
-
class
|
|
293
|
+
z = new WeakMap(), Ae = new WeakMap(), ye = new WeakMap();
|
|
294
|
+
class Fn {
|
|
295
295
|
constructor(e = 100, t = 100) {
|
|
296
296
|
n(this, "resizeSteps");
|
|
297
297
|
n(this, "internalBuffer");
|
|
@@ -372,12 +372,12 @@ class qe {
|
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
const
|
|
375
|
+
const Ut = (i) => i.reduce((e, t) => e + t, 0) / i.length, Ye = (i) => ({
|
|
376
376
|
last: i[i.length - 1] || 0,
|
|
377
|
-
average: i.length === 0 ? 0 :
|
|
377
|
+
average: i.length === 0 ? 0 : Ut(i),
|
|
378
378
|
max: i.length === 0 ? 0 : Math.max(...i),
|
|
379
379
|
min: i.length === 0 ? 0 : Math.min(...i)
|
|
380
|
-
}),
|
|
380
|
+
}), Nn = (i) => {
|
|
381
381
|
let e = 0, t = 0, s = 0, r = 0, o = 0;
|
|
382
382
|
for (let u = 0; u < i.length; u++) {
|
|
383
383
|
const { x: l, y: m } = i[u];
|
|
@@ -389,7 +389,7 @@ const xt = (i) => i.reduce((e, t) => e + t, 0) / i.length, Ye = (i) => ({
|
|
|
389
389
|
);
|
|
390
390
|
return { slope: a, intercept: c, r2: h, predict: (u) => a * (i.length + u) + c };
|
|
391
391
|
};
|
|
392
|
-
class
|
|
392
|
+
class Vn {
|
|
393
393
|
constructor(e = 10) {
|
|
394
394
|
n(this, "rates");
|
|
395
395
|
n(this, "_total", 0);
|
|
@@ -402,13 +402,13 @@ class Fn {
|
|
|
402
402
|
const e = this.accumulatedValues / ((Date.now() - this.lastTickTime) / 1e3);
|
|
403
403
|
this.rates.push(e), this.accumulatedValues = 0, this.lastTickTime = Date.now();
|
|
404
404
|
});
|
|
405
|
-
this.rates = new
|
|
405
|
+
this.rates = new J(e);
|
|
406
406
|
}
|
|
407
407
|
get total() {
|
|
408
408
|
return this._total;
|
|
409
409
|
}
|
|
410
410
|
get average() {
|
|
411
|
-
return this.rates.isEmpty() ? 0 :
|
|
411
|
+
return this.rates.isEmpty() ? 0 : Ut(this.rates.items());
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
const je = (i, e) => {
|
|
@@ -419,7 +419,7 @@ const je = (i, e) => {
|
|
|
419
419
|
for (const r in e)
|
|
420
420
|
if (s += 1, !(r in i) || !je(i[r], e[r])) return !1;
|
|
421
421
|
return t == s;
|
|
422
|
-
},
|
|
422
|
+
}, as = ["off", "error", "warn", "info", "debug", "trace"], zn = {
|
|
423
423
|
ERROR: "error",
|
|
424
424
|
WARN: "warn",
|
|
425
425
|
INFO: "info",
|
|
@@ -427,11 +427,11 @@ const je = (i, e) => {
|
|
|
427
427
|
TRACE: "trace",
|
|
428
428
|
OFF: "off"
|
|
429
429
|
};
|
|
430
|
-
var De,
|
|
431
|
-
const
|
|
430
|
+
var De, yt, Oe, rt, ot;
|
|
431
|
+
const Se = class Se {
|
|
432
432
|
constructor({ context: e, logLevel: t, debug: s }) {
|
|
433
433
|
w(this, De, /* @__PURE__ */ new Map());
|
|
434
|
-
w(this,
|
|
434
|
+
w(this, yt, "");
|
|
435
435
|
w(this, Oe, !1);
|
|
436
436
|
w(this, rt, "off");
|
|
437
437
|
n(this, "trace", (...e) => {
|
|
@@ -448,10 +448,10 @@ const ve = class ve {
|
|
|
448
448
|
});
|
|
449
449
|
n(this, "count", (...e) => {
|
|
450
450
|
});
|
|
451
|
-
|
|
451
|
+
S(this, yt, e), S(this, rt, t), S(this, Oe, s || !1), this.setLevel(t), this.setDebug(d(this, Oe));
|
|
452
452
|
}
|
|
453
453
|
setDebug(e) {
|
|
454
|
-
|
|
454
|
+
S(this, Oe, e);
|
|
455
455
|
for (const [t, s] of d(this, De))
|
|
456
456
|
s.setDebug(e);
|
|
457
457
|
e ? (this.table = console.table.bind(console), this.count = console.count.bind(console)) : (this.table = () => {
|
|
@@ -459,41 +459,41 @@ const ve = class ve {
|
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
setLevel(e) {
|
|
462
|
-
|
|
462
|
+
S(this, rt, e);
|
|
463
463
|
for (const [s, r] of d(this, De))
|
|
464
464
|
r.setLevel(e);
|
|
465
|
-
const t =
|
|
466
|
-
for (const [s, r] of
|
|
465
|
+
const t = as.indexOf(e);
|
|
466
|
+
for (const [s, r] of as.entries())
|
|
467
467
|
r !== "off" && (s <= t ? this[r] = console[r].bind(
|
|
468
468
|
console,
|
|
469
469
|
"%c%s %c%s",
|
|
470
470
|
"font-weight:bold;",
|
|
471
471
|
r.toUpperCase(),
|
|
472
472
|
"font-weight:normal;",
|
|
473
|
-
d(this,
|
|
473
|
+
d(this, yt)
|
|
474
474
|
) : this[r] = () => {
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
477
|
createContext(e) {
|
|
478
478
|
const t = d(this, De).get(e);
|
|
479
479
|
if (!t) {
|
|
480
|
-
const s = new
|
|
480
|
+
const s = new Se({ context: `${e}`, logLevel: d(this, rt), debug: d(this, Oe) });
|
|
481
481
|
return d(this, De).set(e, s), s;
|
|
482
482
|
}
|
|
483
483
|
return t;
|
|
484
484
|
}
|
|
485
485
|
static get() {
|
|
486
|
-
return d(
|
|
486
|
+
return d(Se, ot) || S(Se, ot, new Se({ context: "Vindral", logLevel: "off" })), d(Se, ot);
|
|
487
487
|
}
|
|
488
488
|
};
|
|
489
|
-
De = new WeakMap(),
|
|
490
|
-
let
|
|
491
|
-
function
|
|
492
|
-
const e =
|
|
489
|
+
De = new WeakMap(), yt = new WeakMap(), Oe = new WeakMap(), rt = new WeakMap(), ot = new WeakMap(), w(Se, ot);
|
|
490
|
+
let Nt = Se;
|
|
491
|
+
function $a(i) {
|
|
492
|
+
const e = Nt.get().createContext(i.context);
|
|
493
493
|
return function(s, r) {
|
|
494
494
|
const o = String(r.name);
|
|
495
495
|
function a(...c) {
|
|
496
|
-
i.enter && e[i.enter](`Enter '${o}'`,
|
|
496
|
+
i.enter && e[i.enter](`Enter '${o}'`, A({}, c));
|
|
497
497
|
try {
|
|
498
498
|
const h = s.call(this, ...c);
|
|
499
499
|
return h instanceof Promise ? h.then((u) => {
|
|
@@ -508,27 +508,27 @@ function Za(i) {
|
|
|
508
508
|
return a;
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
|
-
const
|
|
512
|
-
const t =
|
|
511
|
+
const cs = (i, e) => {
|
|
512
|
+
const t = A({}, i);
|
|
513
513
|
return typeof t != "object" || e.forEach((s) => {
|
|
514
514
|
delete t[s];
|
|
515
515
|
}), t;
|
|
516
|
-
},
|
|
516
|
+
}, Me = (i, e = Date.now()) => {
|
|
517
517
|
const t = i.length;
|
|
518
518
|
if (t > 0) {
|
|
519
519
|
const s = t - 1, r = i[s];
|
|
520
520
|
r.end || (r.end = e);
|
|
521
521
|
}
|
|
522
522
|
}, Ze = (i, e = Date.now()) => {
|
|
523
|
-
|
|
523
|
+
Me(i), i.push({ start: e });
|
|
524
524
|
}, Je = (i) => i.reduce((e, t) => {
|
|
525
525
|
var s;
|
|
526
526
|
return e + (((s = t.end) != null ? s : Date.now()) - t.start);
|
|
527
|
-
}, 0),
|
|
527
|
+
}, 0), ds = (i, e, t = Date.now()) => i.reduce((s, r) => {
|
|
528
528
|
var c;
|
|
529
529
|
const o = Math.max(t - e, r.start), a = (c = r.end) != null ? c : t;
|
|
530
530
|
return Math.max(0, a - o) + s;
|
|
531
|
-
}, 0),
|
|
531
|
+
}, 0), Wt = class Wt {
|
|
532
532
|
constructor() {
|
|
533
533
|
n(this, "pendingTimeouts", /* @__PURE__ */ new Set());
|
|
534
534
|
n(this, "pendingIntervals", /* @__PURE__ */ new Set());
|
|
@@ -555,14 +555,14 @@ const as = (i, e) => {
|
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
557
|
};
|
|
558
|
-
n(
|
|
559
|
-
let
|
|
560
|
-
const
|
|
558
|
+
n(Wt, "create", () => new Wt());
|
|
559
|
+
let q = Wt;
|
|
560
|
+
const hs = () => {
|
|
561
561
|
const i = [...Array(256).keys()].map((t) => t.toString(16).padStart(2, "0")), e = crypto.getRandomValues(new Uint8Array(16));
|
|
562
562
|
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, [...e.entries()].map(([t, s]) => [4, 6, 8, 10].includes(t) ? `-${i[s]}` : i[s]).join("");
|
|
563
|
-
},
|
|
563
|
+
}, xi = (i) => y(void 0, null, function* () {
|
|
564
564
|
return new Promise((e) => setTimeout(e, i));
|
|
565
|
-
}),
|
|
565
|
+
}), Hn = (t, ...s) => y(void 0, [t, ...s], function* (i, e = new Error("Timeout")) {
|
|
566
566
|
return new Promise((r, o) => setTimeout(() => o(e), i));
|
|
567
567
|
}), st = (i) => "width" in i && typeof i.width == "number", nt = (i) => "sampleRate" in i && typeof i.sampleRate == "number", $e = (i) => {
|
|
568
568
|
switch (i.codec) {
|
|
@@ -579,16 +579,16 @@ const ds = () => {
|
|
|
579
579
|
case "av1":
|
|
580
580
|
return i.codecString ? `video/mp4; codecs="${i.codecString}"` : "video/mp4";
|
|
581
581
|
}
|
|
582
|
-
}, ke = () => Number.MAX_SAFE_INTEGER,
|
|
582
|
+
}, ke = () => Number.MAX_SAFE_INTEGER, Vt = () => ({
|
|
583
583
|
width: Number.MAX_SAFE_INTEGER,
|
|
584
584
|
height: Number.MAX_SAFE_INTEGER
|
|
585
|
-
}),
|
|
586
|
-
function
|
|
585
|
+
}), us = (i) => !(typeof i != "object" || i === null || !("type" in i)), Qn = !0;
|
|
586
|
+
function Xn() {
|
|
587
587
|
return {
|
|
588
|
-
moqEnabled:
|
|
588
|
+
moqEnabled: Qn
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
const
|
|
591
|
+
const Gn = {
|
|
592
592
|
sizeBasedResolutionCapEnabled: !0,
|
|
593
593
|
pictureInPictureEnabled: !0,
|
|
594
594
|
abrEnabled: !0,
|
|
@@ -598,8 +598,8 @@ const Qn = {
|
|
|
598
598
|
muted: !1,
|
|
599
599
|
minBufferTime: 1500,
|
|
600
600
|
maxBufferTime: 1500,
|
|
601
|
-
logLevel:
|
|
602
|
-
maxSize:
|
|
601
|
+
logLevel: zn.OFF,
|
|
602
|
+
maxSize: Vt(),
|
|
603
603
|
maxVideoBitRate: ke(),
|
|
604
604
|
maxAudioBitRate: ke(),
|
|
605
605
|
tags: [],
|
|
@@ -618,8 +618,9 @@ const Qn = {
|
|
|
618
618
|
height: 1280
|
|
619
619
|
}
|
|
620
620
|
},
|
|
621
|
-
videoCodecs: ["av1", "h264"]
|
|
622
|
-
|
|
621
|
+
videoCodecs: ["av1", "h264"],
|
|
622
|
+
webtransportEnabled: !0
|
|
623
|
+
}, Wn = "connection_failed", jn = "connection_failed_will_not_attempt_again", qn = "authentication_error", Zn = "authentication_expired", Jn = "channel_not_found", Yn = "no_incoming_data_error", Kn = "connection_inactivity", $n = "missing_init_segment", er = "no_track_context", tr = "invalid_track_context_state", ir = "disconnected_by_edge", sr = "decoder_error", nr = "audio_player_error", rr = "media_source_error", or = "webgl_context_lost_error", ar = "access_forbidden", cr = "channel_switch_failed";
|
|
623
624
|
class T extends Error {
|
|
624
625
|
constructor(t, s, r = {}) {
|
|
625
626
|
super(t);
|
|
@@ -650,7 +651,7 @@ class T extends Error {
|
|
|
650
651
|
n(this, "toStringifiable", () => {
|
|
651
652
|
var r;
|
|
652
653
|
const t = this.source(), s = t instanceof Error ? t.stack : this.stack;
|
|
653
|
-
return
|
|
654
|
+
return L(A({}, this.extra), {
|
|
654
655
|
code: this.props.code,
|
|
655
656
|
isFatal: this.props.isFatal,
|
|
656
657
|
type: this.props.type,
|
|
@@ -662,55 +663,55 @@ class T extends Error {
|
|
|
662
663
|
this.props = s, this.extra = r, Object.setPrototypeOf(this, new.target.prototype);
|
|
663
664
|
}
|
|
664
665
|
}
|
|
665
|
-
const
|
|
666
|
+
const dr = (i, e) => new T(
|
|
666
667
|
"MediaElement Error",
|
|
667
668
|
{ isFatal: i, code: "media_element_error", source: e },
|
|
668
669
|
{ mediaErrorCode: e.code }
|
|
669
|
-
),
|
|
670
|
+
), hr = (i, e) => new T("Decoder Error", { isFatal: i, code: sr, source: e, type: "internal" }), Hs = (i, e) => new T("Audio Player Error", { isFatal: i, code: nr, source: e, type: "internal" }), ur = (i, e) => new T(`No init segment for rendition id ${i} for channel ${e}`, {
|
|
670
671
|
isFatal: !1,
|
|
671
|
-
code:
|
|
672
|
+
code: $n,
|
|
672
673
|
type: "internal"
|
|
673
|
-
}),
|
|
674
|
+
}), ls = (i, e, t, s) => new T(
|
|
674
675
|
"MediaSource Error",
|
|
675
|
-
{ isFatal: i, code:
|
|
676
|
+
{ isFatal: i, code: rr, source: e, type: "internal" },
|
|
676
677
|
{ type: s, consecutiveErrorsCount: t }
|
|
677
|
-
),
|
|
678
|
+
), _t = (i, e) => new T(`No track context for ${i}${e ? `, rendition id ${e}` : ""}`, {
|
|
678
679
|
isFatal: !1,
|
|
679
|
-
code:
|
|
680
|
+
code: er,
|
|
680
681
|
type: "internal"
|
|
681
|
-
}),
|
|
682
|
+
}), ms = (i, e) => new T(
|
|
682
683
|
`Track context is in an invalid state for ${i}${e ? `, rendition id ${e}` : ""}`,
|
|
683
684
|
{
|
|
684
685
|
isFatal: !1,
|
|
685
|
-
code:
|
|
686
|
+
code: tr,
|
|
686
687
|
type: "internal"
|
|
687
688
|
}
|
|
688
|
-
),
|
|
689
|
+
), lr = () => new T("Web Audio Context resume timeout", { isFatal: !1, code: "web_audio_context_resume_timeout" }), ft = (i) => new T("Disconnected From Edge Server", {
|
|
689
690
|
type: "external",
|
|
690
691
|
source: i,
|
|
691
692
|
isFatal: !1,
|
|
692
|
-
code:
|
|
693
|
-
}),
|
|
693
|
+
code: ir
|
|
694
|
+
}), zt = (i) => new T("Authentication Failed", { isFatal: !0, code: qn, source: i }), mr = (i) => new T("Authentication Expired", { isFatal: !0, code: Zn, source: i }), fr = (i, e) => new T("Connection closed due to inactivity", { isFatal: !1, code: Kn, source: e, type: i }), Qs = (i, e) => new T("Channel not found", { isFatal: !1, code: Jn, source: e, type: i }), Ar = (i) => new T("No Incoming Data", { isFatal: !1, code: Yn, source: i }), gr = (i) => new T("Connection attempt failed", {
|
|
694
695
|
isFatal: !1,
|
|
695
|
-
code:
|
|
696
|
+
code: Wn,
|
|
696
697
|
source: i
|
|
697
|
-
}),
|
|
698
|
+
}), Xs = () => new T("Connection failed - no more reconnect attempts", {
|
|
698
699
|
isFatal: !0,
|
|
699
|
-
code:
|
|
700
|
-
}),
|
|
701
|
-
if (!
|
|
700
|
+
code: jn
|
|
701
|
+
}), pr = (i) => new T("WebGL Context Lost", { isFatal: !1, code: or, source: i, type: "internal" }), fs = (i) => new T(i, { isFatal: !0, code: ar }), As = (i) => new T(`Channel switch to '${i}' failed`, { isFatal: !1, code: cr }), gs = (i, e) => i && typeof i == "object" && e in i, wr = (i) => !(typeof i != "object" || !gs(i, "channelId") || typeof i.channelId != "string" || !gs(i, "url") || typeof i.url != "string" || i.channelId.length === 0 || i.url.length === 0), Sr = (i) => {
|
|
702
|
+
if (!wr(i))
|
|
702
703
|
throw new T("Invalid options", { isFatal: !0, code: "invalid_options" });
|
|
703
|
-
const e =
|
|
704
|
+
const e = A({}, i);
|
|
704
705
|
return Object.keys(e).forEach((t) => {
|
|
705
706
|
const s = e;
|
|
706
707
|
typeof s[t] == "undefined" && delete s[t];
|
|
707
708
|
}), e;
|
|
708
|
-
},
|
|
709
|
+
}, vr = {
|
|
709
710
|
playready: ["150", "2000", "3000"],
|
|
710
711
|
widevine: ["SW_SECURE_CRYPTO", "SW_SECURE_DECODE", "HW_SECURE_CRYPTO", "HW_SECURE_DECODE", "HW_SECURE_ALL"],
|
|
711
712
|
fairplay: [""],
|
|
712
713
|
clearkey: [""]
|
|
713
|
-
},
|
|
714
|
+
}, Ei = {
|
|
714
715
|
initDataTypes: ["cenc"],
|
|
715
716
|
audioCapabilities: [
|
|
716
717
|
{
|
|
@@ -722,7 +723,7 @@ const or = (i, e) => new T(
|
|
|
722
723
|
contentType: 'video/mp4; codecs="avc1.42c01f"'
|
|
723
724
|
}
|
|
724
725
|
]
|
|
725
|
-
},
|
|
726
|
+
}, br = {
|
|
726
727
|
fairplay: {
|
|
727
728
|
keySystem: "com.apple.fps",
|
|
728
729
|
supportedConfig: {
|
|
@@ -736,54 +737,69 @@ const or = (i, e) => new T(
|
|
|
736
737
|
},
|
|
737
738
|
playready: {
|
|
738
739
|
keySystem: "com.microsoft.playready",
|
|
739
|
-
supportedConfig:
|
|
740
|
+
supportedConfig: Ei
|
|
740
741
|
},
|
|
741
742
|
widevine: {
|
|
742
743
|
keySystem: "com.widevine.alpha",
|
|
743
|
-
supportedConfig:
|
|
744
|
+
supportedConfig: Ei
|
|
744
745
|
},
|
|
745
746
|
clearkey: {
|
|
746
747
|
keySystem: "org.w3.clearkey",
|
|
747
|
-
supportedConfig:
|
|
748
|
+
supportedConfig: Ei
|
|
748
749
|
}
|
|
749
|
-
},
|
|
750
|
+
}, Gs = (i, e) => y(void 0, null, function* () {
|
|
750
751
|
return navigator.requestMediaKeySystemAccess(i, [e]).catch(() => {
|
|
751
752
|
});
|
|
752
|
-
}),
|
|
753
|
-
let
|
|
754
|
-
for (const
|
|
755
|
-
const
|
|
756
|
-
robustness:
|
|
753
|
+
}), ps = (i, e, t, s, r, o) => y(void 0, null, function* () {
|
|
754
|
+
let a;
|
|
755
|
+
for (const c of s) {
|
|
756
|
+
const h = t == null ? void 0 : t.map((l) => L(A({}, l), {
|
|
757
|
+
robustness: c,
|
|
758
|
+
contentType: o ? `${r === "audioCapabilities" ? "audio/mp4" : "video/mp4"}; codecs="${o}"` : l.contentType
|
|
757
759
|
}));
|
|
758
|
-
if (!(yield
|
|
760
|
+
if (!(yield Gs(i, {
|
|
759
761
|
initDataTypes: e,
|
|
760
|
-
[r]:
|
|
762
|
+
[r]: h
|
|
761
763
|
})))
|
|
762
764
|
break;
|
|
763
|
-
|
|
765
|
+
a = h;
|
|
764
766
|
}
|
|
765
|
-
return
|
|
766
|
-
}),
|
|
767
|
-
const { keySystem:
|
|
768
|
-
|
|
769
|
-
|
|
767
|
+
return a;
|
|
768
|
+
}), yr = (i, e, t) => y(void 0, null, function* () {
|
|
769
|
+
const { keySystem: s, supportedConfig: r } = br[i], { initDataTypes: o, videoCapabilities: a, audioCapabilities: c } = r, h = vr[i], [u, l] = yield Promise.all([
|
|
770
|
+
ps(
|
|
771
|
+
s,
|
|
772
|
+
o,
|
|
773
|
+
a,
|
|
774
|
+
h,
|
|
775
|
+
"videoCapabilities",
|
|
776
|
+
e
|
|
777
|
+
),
|
|
778
|
+
ps(
|
|
779
|
+
s,
|
|
780
|
+
o,
|
|
781
|
+
c,
|
|
782
|
+
h,
|
|
783
|
+
"audioCapabilities",
|
|
784
|
+
t
|
|
785
|
+
)
|
|
770
786
|
]);
|
|
771
|
-
return !
|
|
772
|
-
initDataTypes:
|
|
773
|
-
videoCapabilities:
|
|
774
|
-
audioCapabilities:
|
|
787
|
+
return !u && !l ? void 0 : yield Gs(s, {
|
|
788
|
+
initDataTypes: o,
|
|
789
|
+
videoCapabilities: u,
|
|
790
|
+
audioCapabilities: l
|
|
775
791
|
});
|
|
776
|
-
}),
|
|
777
|
-
let
|
|
778
|
-
for (const
|
|
779
|
-
if (
|
|
792
|
+
}), Er = (i, e, t) => y(void 0, null, function* () {
|
|
793
|
+
let s;
|
|
794
|
+
for (const r of i)
|
|
795
|
+
if (s = yield yr(r, e, t), s)
|
|
780
796
|
return {
|
|
781
|
-
keySystem:
|
|
782
|
-
mediaKeySystemAccess:
|
|
797
|
+
keySystem: r,
|
|
798
|
+
mediaKeySystemAccess: s
|
|
783
799
|
};
|
|
784
800
|
});
|
|
785
801
|
var Fe, Ne;
|
|
786
|
-
class
|
|
802
|
+
class wi {
|
|
787
803
|
constructor(e, t, s, r) {
|
|
788
804
|
n(this, "keySystem");
|
|
789
805
|
n(this, "licenseServerUrl");
|
|
@@ -792,7 +808,7 @@ class gi {
|
|
|
792
808
|
n(this, "queryParams", {});
|
|
793
809
|
w(this, Fe);
|
|
794
810
|
w(this, Ne);
|
|
795
|
-
|
|
811
|
+
S(this, Fe, t), this.keySystem = e, this.licenseServerUrl = s, this.certificate = r;
|
|
796
812
|
}
|
|
797
813
|
get statistics() {
|
|
798
814
|
return {
|
|
@@ -803,7 +819,7 @@ class gi {
|
|
|
803
819
|
}
|
|
804
820
|
getMediaKeys() {
|
|
805
821
|
return y(this, null, function* () {
|
|
806
|
-
return d(this, Ne) ? d(this, Ne) : (
|
|
822
|
+
return d(this, Ne) ? d(this, Ne) : (S(this, Ne, yield d(this, Fe).createMediaKeys()), d(this, Ne));
|
|
807
823
|
});
|
|
808
824
|
}
|
|
809
825
|
requestLicense(e) {
|
|
@@ -814,7 +830,7 @@ class gi {
|
|
|
814
830
|
const s = yield fetch(t, {
|
|
815
831
|
method: "POST",
|
|
816
832
|
body: e,
|
|
817
|
-
headers:
|
|
833
|
+
headers: A({
|
|
818
834
|
"Content-Type": "application/octet-stream"
|
|
819
835
|
}, this.headers)
|
|
820
836
|
});
|
|
@@ -825,44 +841,44 @@ class gi {
|
|
|
825
841
|
}
|
|
826
842
|
}
|
|
827
843
|
Fe = new WeakMap(), Ne = new WeakMap();
|
|
828
|
-
function
|
|
844
|
+
function Ws(i) {
|
|
829
845
|
const e = window.atob(i.replace(/-/g, "+").replace(/_/g, "/"));
|
|
830
846
|
let t = "";
|
|
831
847
|
for (let s = 0; s < e.length; s++)
|
|
832
848
|
t += ("0" + e.charCodeAt(s).toString(16)).substr(-2);
|
|
833
849
|
return t;
|
|
834
850
|
}
|
|
835
|
-
function
|
|
851
|
+
function Tr(i) {
|
|
836
852
|
let e = "";
|
|
837
853
|
for (let t = 0; t < i.length; t += 2)
|
|
838
854
|
e += String.fromCharCode(parseInt(i.substr(t, 2), 16));
|
|
839
855
|
return window.btoa(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
840
856
|
}
|
|
841
|
-
function
|
|
857
|
+
function Cr(i, e) {
|
|
842
858
|
if (i.byteLength !== e.byteLength) return !1;
|
|
843
859
|
const t = new Uint8Array(i), s = new Uint8Array(e);
|
|
844
860
|
for (let r = 0; r < t.length; r++)
|
|
845
861
|
if (t[r] !== s[r]) return !1;
|
|
846
862
|
return !0;
|
|
847
863
|
}
|
|
848
|
-
var
|
|
849
|
-
class
|
|
864
|
+
var Et;
|
|
865
|
+
class Ir extends wi {
|
|
850
866
|
constructor(t, s) {
|
|
851
867
|
super("clearkey", t, "");
|
|
852
|
-
w(this,
|
|
853
|
-
|
|
868
|
+
w(this, Et);
|
|
869
|
+
S(this, Et, s);
|
|
854
870
|
}
|
|
855
871
|
handleLicenseRequest(t) {
|
|
856
872
|
const s = new Uint8Array(t), r = String.fromCharCode(...s), o = JSON.parse(r), a = [];
|
|
857
873
|
for (let u = 0; u < o.kids.length; u++) {
|
|
858
874
|
const l = o.kids[u];
|
|
859
875
|
if (l) {
|
|
860
|
-
const m =
|
|
876
|
+
const m = Ws(l).toLowerCase(), g = d(this, Et)[m];
|
|
861
877
|
g && a.push({
|
|
862
878
|
kty: "oct",
|
|
863
879
|
alg: "A128KW",
|
|
864
880
|
kid: l,
|
|
865
|
-
k:
|
|
881
|
+
k: Tr(g)
|
|
866
882
|
});
|
|
867
883
|
}
|
|
868
884
|
}
|
|
@@ -873,21 +889,21 @@ class Er extends gi {
|
|
|
873
889
|
return new TextEncoder().encode(c);
|
|
874
890
|
}
|
|
875
891
|
}
|
|
876
|
-
|
|
877
|
-
class
|
|
892
|
+
Et = new WeakMap();
|
|
893
|
+
class Br extends wi {
|
|
878
894
|
constructor(e, t, s) {
|
|
879
895
|
super("fairplay", e, t, s);
|
|
880
896
|
}
|
|
881
897
|
}
|
|
882
|
-
const
|
|
898
|
+
const Rr = (i) => {
|
|
883
899
|
var c, h, u, l;
|
|
884
900
|
const e = String.fromCharCode(...new Uint16Array(i)), t = new window.DOMParser().parseFromString(e, "application/xml"), s = t.getElementsByTagName("HttpHeaders")[0];
|
|
885
901
|
let r = {};
|
|
886
902
|
if (s) {
|
|
887
903
|
const m = s.getElementsByTagName("name"), g = s.getElementsByTagName("value");
|
|
888
904
|
for (let p = 0; p < m.length; p++) {
|
|
889
|
-
const E = (c = m[p]) == null ? void 0 : c.childNodes[0],
|
|
890
|
-
E != null && E.nodeValue &&
|
|
905
|
+
const E = (c = m[p]) == null ? void 0 : c.childNodes[0], U = (h = g[p]) == null ? void 0 : h.childNodes[0];
|
|
906
|
+
E != null && E.nodeValue && U && U.nodeValue && (r[E.nodeValue] = U.nodeValue);
|
|
891
907
|
}
|
|
892
908
|
}
|
|
893
909
|
const o = t.getElementsByTagName("Challenge")[0];
|
|
@@ -900,7 +916,7 @@ const Cr = (i) => {
|
|
|
900
916
|
message: a
|
|
901
917
|
};
|
|
902
918
|
};
|
|
903
|
-
class
|
|
919
|
+
class kr extends wi {
|
|
904
920
|
constructor(e, t) {
|
|
905
921
|
super("playready", e, t);
|
|
906
922
|
}
|
|
@@ -910,9 +926,9 @@ class Ir extends gi {
|
|
|
910
926
|
const t = new URL(this.licenseServerUrl);
|
|
911
927
|
for (const [o, a] of Object.entries(this.queryParams))
|
|
912
928
|
t.searchParams.append(o, a);
|
|
913
|
-
const s =
|
|
929
|
+
const s = Rr(e), r = yield fetch(t, {
|
|
914
930
|
method: "POST",
|
|
915
|
-
headers:
|
|
931
|
+
headers: A(A({}, s.headers), this.headers),
|
|
916
932
|
body: s.message
|
|
917
933
|
});
|
|
918
934
|
if (!r.ok)
|
|
@@ -921,31 +937,31 @@ class Ir extends gi {
|
|
|
921
937
|
});
|
|
922
938
|
}
|
|
923
939
|
}
|
|
924
|
-
class
|
|
940
|
+
class Pr extends wi {
|
|
925
941
|
constructor(e, t) {
|
|
926
942
|
super("widevine", e, t);
|
|
927
943
|
}
|
|
928
944
|
}
|
|
929
|
-
var R, Ve, ge, ze,
|
|
930
|
-
class
|
|
945
|
+
var R, Ve, ge, ze, Tt, Ct, de, Ee, Te, It, Bt, W, js, qs, Zs, Js, jt, qt, Ys, Ft, Zt, Ks;
|
|
946
|
+
class ws {
|
|
931
947
|
constructor(e, t, s, r) {
|
|
932
|
-
w(this,
|
|
948
|
+
w(this, W);
|
|
933
949
|
w(this, R);
|
|
934
950
|
w(this, Ve);
|
|
935
951
|
w(this, ge);
|
|
936
|
-
w(this, ze, new
|
|
937
|
-
w(this, Et, {});
|
|
952
|
+
w(this, ze, new St());
|
|
938
953
|
w(this, Tt, {});
|
|
954
|
+
w(this, Ct, {});
|
|
939
955
|
w(this, de, null);
|
|
940
956
|
w(this, Ee, /* @__PURE__ */ new Map());
|
|
941
957
|
w(this, Te, null);
|
|
942
|
-
w(this,
|
|
958
|
+
w(this, It, (e) => {
|
|
943
959
|
d(this, R).debug("Received DRM data", { options: e }), d(this, ze).resolve(e);
|
|
944
960
|
});
|
|
945
|
-
w(this,
|
|
946
|
-
d(this, R).info("Encrypted event received", { event: e }),
|
|
961
|
+
w(this, Bt, (e) => {
|
|
962
|
+
d(this, R).info("Encrypted event received", { event: e }), F(this, W, js).call(this, e);
|
|
947
963
|
});
|
|
948
|
-
w(this,
|
|
964
|
+
w(this, jt, (e) => {
|
|
949
965
|
var o;
|
|
950
966
|
d(this, R).debug("Session message received", { event: e });
|
|
951
967
|
const t = e.target, s = e.message;
|
|
@@ -954,61 +970,62 @@ class gs {
|
|
|
954
970
|
return;
|
|
955
971
|
}
|
|
956
972
|
d(this, R).debug("Requesting license for session", { sessionId: t.sessionId }), (o = d(this, de)) == null || o.requestLicense(s).then((a) => {
|
|
957
|
-
d(this, R).debug("License received for session", { sessionId: t.sessionId }), t.update(a)
|
|
973
|
+
d(this, R).debug("License received for session", { sessionId: t.sessionId }), t.update(a).catch((c) => {
|
|
974
|
+
F(this, W, Ft).call(this, { message: "Failed to update session with license", code: "eme", isFatal: !1, error: c });
|
|
975
|
+
});
|
|
976
|
+
}).catch((a) => {
|
|
977
|
+
F(this, W, Ft).call(this, { message: "Failed to request license", code: "eme", isFatal: !1, error: a });
|
|
958
978
|
});
|
|
959
979
|
});
|
|
960
|
-
w(this,
|
|
980
|
+
w(this, qt, (e) => {
|
|
961
981
|
const t = e.target;
|
|
962
982
|
d(this, R).debug("Key status changed for session", { sessionId: t.sessionId }), t.keyStatuses.forEach((s, r) => {
|
|
963
|
-
const o =
|
|
983
|
+
const o = Ws(window.btoa(String.fromCharCode(...new Uint8Array(r))));
|
|
964
984
|
d(this, R).debug("Key status", { base64kid: o, status: s });
|
|
965
985
|
});
|
|
966
986
|
});
|
|
967
987
|
/**
|
|
968
988
|
* Get the CDM based on the options and the supported key systems
|
|
969
989
|
*/
|
|
970
|
-
w(this,
|
|
971
|
-
const t =
|
|
990
|
+
w(this, Zt, (e) => y(this, null, function* () {
|
|
991
|
+
const t = F(this, W, Ks).call(this, e);
|
|
972
992
|
d(this, R).debug("Prioritized key system list", { keySystemList: t });
|
|
973
|
-
const s = yield
|
|
993
|
+
const s = yield Er(t, e.videoCodec, e.audioCodec);
|
|
974
994
|
if (!s)
|
|
975
995
|
return d(this, R).debug("No supported key system found"), null;
|
|
976
996
|
d(this, R).debug("Supported key system found", s.mediaKeySystemAccess.getConfiguration());
|
|
977
997
|
const { keySystem: r, mediaKeySystemAccess: o } = s;
|
|
978
998
|
let a = null;
|
|
979
|
-
return r === "clearkey" ? (ae(e.clearkeys, "No clearkeys found"), a = new
|
|
999
|
+
return r === "clearkey" ? (ae(e.clearkeys, "No clearkeys found"), a = new Ir(o, e.clearkeys)) : r === "playready" ? (ae(e.playreadyLicenseUrl, "No playreadyLicenseUrl found"), a = new kr(o, e.playreadyLicenseUrl)) : r === "widevine" ? (ae(e.widevineLicenseUrl, "No widevineLicenseUrl found"), a = new Pr(o, e.widevineLicenseUrl)) : r === "fairplay" && (ae(e.fairplayLicenseUrl, "No fairplayLicenseUrl found"), ae(e.fairplayCertificate, "No fairplayCertificate found"), a = new Br(o, e.fairplayLicenseUrl, e.fairplayCertificate)), a && (a.headers = d(this, Tt), a.queryParams = d(this, Ct)), a;
|
|
980
1000
|
}));
|
|
981
|
-
|
|
1001
|
+
S(this, Ve, e), S(this, R, t), S(this, Tt, s || {}), S(this, Ct, r || {}), d(this, Ve).on("received drm data", d(this, It));
|
|
982
1002
|
}
|
|
983
1003
|
static isSupported() {
|
|
984
1004
|
return !!navigator.requestMediaKeySystemAccess;
|
|
985
1005
|
}
|
|
986
1006
|
attach(e) {
|
|
987
|
-
|
|
1007
|
+
S(this, ge, e), d(this, R).info("Media element attached"), d(this, ge).addEventListener("encrypted", d(this, Bt));
|
|
988
1008
|
}
|
|
989
1009
|
getStatistics() {
|
|
990
1010
|
var e, t;
|
|
991
|
-
return !d(this, ze).resolved && !((e = d(this, de)) != null && e.statistics) ? null :
|
|
1011
|
+
return !d(this, ze).resolved && !((e = d(this, de)) != null && e.statistics) ? null : A(A({}, d(this, ze).resolved), (t = d(this, de)) == null ? void 0 : t.statistics);
|
|
992
1012
|
}
|
|
993
1013
|
unload() {
|
|
994
1014
|
var e;
|
|
995
|
-
d(this, R).info("Unloading EncryptedMediaExtensions"), d(this, Ve).off("received drm data", d(this,
|
|
1015
|
+
d(this, R).info("Unloading EncryptedMediaExtensions"), d(this, Ve).off("received drm data", d(this, It)), (e = d(this, ge)) == null || e.removeEventListener("encrypted", d(this, Bt)), d(this, Ee).forEach((t, s) => {
|
|
996
1016
|
s.close();
|
|
997
|
-
}), d(this, Ee).clear(),
|
|
1017
|
+
}), d(this, Ee).clear(), S(this, Te, null), S(this, de, null);
|
|
998
1018
|
}
|
|
999
1019
|
}
|
|
1000
|
-
R = new WeakMap(), Ve = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(),
|
|
1020
|
+
R = new WeakMap(), Ve = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(), Tt = new WeakMap(), Ct = new WeakMap(), de = new WeakMap(), Ee = new WeakMap(), Te = new WeakMap(), It = new WeakMap(), Bt = new WeakMap(), W = new WeakSet(), js = function(e) {
|
|
1001
1021
|
return y(this, null, function* () {
|
|
1002
1022
|
try {
|
|
1003
|
-
yield
|
|
1023
|
+
yield F(this, W, qs).call(this), d(this, R).debug("Media keys initialization completed"), yield F(this, W, Zs).call(this, e.initData, e.initDataType);
|
|
1004
1024
|
} catch (t) {
|
|
1005
|
-
|
|
1006
|
-
"error",
|
|
1007
|
-
new T("Failed to handle encrypted event", { code: "eme", isFatal: !0 }, { error: t })
|
|
1008
|
-
);
|
|
1025
|
+
F(this, W, Ft).call(this, { message: "Failed to handle encrypted event", code: "eme", isFatal: !0, error: t });
|
|
1009
1026
|
}
|
|
1010
1027
|
});
|
|
1011
|
-
},
|
|
1028
|
+
}, qs = function() {
|
|
1012
1029
|
return y(this, null, function* () {
|
|
1013
1030
|
var e;
|
|
1014
1031
|
if (d(this, R).debug("Initializing media keys"), (e = d(this, ge)) != null && e.mediaKeys) {
|
|
@@ -1019,31 +1036,31 @@ R = new WeakMap(), Ve = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(), E
|
|
|
1019
1036
|
d(this, R).debug("Media keys initialization already in progress, waiting for completion"), yield d(this, Te);
|
|
1020
1037
|
return;
|
|
1021
1038
|
}
|
|
1022
|
-
|
|
1023
|
-
const t = yield d(this, ze).promise, s = yield d(this,
|
|
1039
|
+
S(this, Te, y(this, null, function* () {
|
|
1040
|
+
const t = yield d(this, ze).promise, s = yield d(this, Zt).call(this, t);
|
|
1024
1041
|
d(this, R).debug("CDM obtained", { cdm: s }), ae(d(this, ge), "No media element found"), ae(s, "No CDM found");
|
|
1025
1042
|
const r = yield s.getMediaKeys();
|
|
1026
|
-
s.certificate && (yield
|
|
1043
|
+
s.certificate && (yield F(this, W, Ys).call(this, r, s.certificate)), d(this, R).debug("Setting media keys on media element"), yield d(this, ge).setMediaKeys(r), S(this, de, s);
|
|
1027
1044
|
})), yield d(this, Te);
|
|
1028
1045
|
});
|
|
1029
|
-
},
|
|
1046
|
+
}, Zs = function(e, t) {
|
|
1030
1047
|
return y(this, null, function* () {
|
|
1031
1048
|
ae(d(this, de), "No CDM manager found");
|
|
1032
1049
|
const s = yield d(this, de).getMediaKeys();
|
|
1033
|
-
if (!e || !
|
|
1050
|
+
if (!e || !F(this, W, Js).call(this, e)) {
|
|
1034
1051
|
d(this, R).debug("Duplicate initData, no need to create new session", { initData: e });
|
|
1035
1052
|
return;
|
|
1036
1053
|
}
|
|
1037
1054
|
const r = s.createSession();
|
|
1038
|
-
d(this, R).debug("Creating new session", { session: r }), r.addEventListener("keystatuseschange", d(this,
|
|
1055
|
+
d(this, R).debug("Creating new session", { session: r }), r.addEventListener("keystatuseschange", d(this, qt)), r.closed.then((o) => {
|
|
1039
1056
|
d(this, R).info("Session is closed", { reason: o });
|
|
1040
|
-
}), r.addEventListener("message", d(this,
|
|
1057
|
+
}), r.addEventListener("message", d(this, jt)), d(this, Ee).set(r, e), d(this, R).debug("Generating request for session", { session: r, initDataType: t, initData: e }), yield r.generateRequest(t, e);
|
|
1041
1058
|
});
|
|
1042
|
-
},
|
|
1059
|
+
}, Js = function(e) {
|
|
1043
1060
|
for (const [t, s] of d(this, Ee))
|
|
1044
|
-
if (
|
|
1061
|
+
if (Cr(e, s)) return !1;
|
|
1045
1062
|
return !0;
|
|
1046
|
-
},
|
|
1063
|
+
}, jt = new WeakMap(), qt = new WeakMap(), Ys = function(e, t) {
|
|
1047
1064
|
return y(this, null, function* () {
|
|
1048
1065
|
try {
|
|
1049
1066
|
d(this, R).debug("Setting server certificate", { certificate: t }), (yield e.setServerCertificate(t)) || d(this, R).warn("Server certificates are not supported by the CDM.");
|
|
@@ -1051,38 +1068,41 @@ R = new WeakMap(), Ve = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(), E
|
|
|
1051
1068
|
d(this, R).error("Failed to set server certificate", { error: s });
|
|
1052
1069
|
}
|
|
1053
1070
|
});
|
|
1054
|
-
},
|
|
1071
|
+
}, Ft = function(e) {
|
|
1072
|
+
const { message: t, code: s, isFatal: r, error: o } = e;
|
|
1073
|
+
d(this, R).error(t, { error: o }), d(this, Ve).emit("error", new T(t, { code: s, isFatal: r }, { error: o }));
|
|
1074
|
+
}, Zt = new WeakMap(), /**
|
|
1055
1075
|
* Get the prioritized key system list based on the options provided.
|
|
1056
1076
|
* The order of the key systems in the list is the order in which they will be tried.
|
|
1057
1077
|
* If clearkeys are provided, it will be the first in the list.
|
|
1058
1078
|
* Playready will be prioritized over Widevine, some browsers support both but playready may support higher robustness level.
|
|
1059
1079
|
*/
|
|
1060
|
-
|
|
1080
|
+
Ks = function(e) {
|
|
1061
1081
|
const t = [];
|
|
1062
1082
|
return e.clearkeys && t.push("clearkey"), e.playreadyLicenseUrl && t.push("playready"), e.widevineLicenseUrl && t.push("widevine"), e.fairplayLicenseUrl && e.fairplayCertificate && t.push("fairplay"), t;
|
|
1063
1083
|
};
|
|
1064
|
-
const
|
|
1084
|
+
const xr = 7, Ur = 8, Lr = (i) => {
|
|
1065
1085
|
const e = i.getUint32(0, !1), t = i.getUint8(0) << 16 | i.getUint16(1, !1);
|
|
1066
1086
|
let s = 0;
|
|
1067
1087
|
return t === 1 ? s += 3 : e === 1 && (s += 4), s;
|
|
1068
|
-
},
|
|
1088
|
+
}, Mr = (i) => Lr(new DataView(i, 0)) !== 0, Ss = (i, e = 0) => {
|
|
1069
1089
|
for (let t = e; t < i.byteLength - 4; t++) {
|
|
1070
1090
|
const s = i.getUint32(t) === 1, r = (i.getUint8(t) << 16 | i.getUint16(t + 1)) === 1;
|
|
1071
1091
|
if (s || r)
|
|
1072
1092
|
return { position: t, nalPrefixSize: s ? 4 : 3 };
|
|
1073
1093
|
}
|
|
1074
|
-
},
|
|
1094
|
+
}, _r = (i) => i & 31, Dr = (i, e) => {
|
|
1075
1095
|
const t = new DataView(i, 0);
|
|
1076
|
-
let s =
|
|
1096
|
+
let s = Ss(t);
|
|
1077
1097
|
for (; s; ) {
|
|
1078
|
-
const { position: r, nalPrefixSize: o } = s, a =
|
|
1098
|
+
const { position: r, nalPrefixSize: o } = s, a = Ss(t, r + 4), c = a ? a.position - r - o : void 0;
|
|
1079
1099
|
if (!e(new DataView(i, r + o, c), o))
|
|
1080
1100
|
return;
|
|
1081
1101
|
s = a;
|
|
1082
1102
|
}
|
|
1083
|
-
},
|
|
1103
|
+
}, $s = (i) => {
|
|
1084
1104
|
const e = [], t = [];
|
|
1085
|
-
if (!
|
|
1105
|
+
if (!Mr(i)) {
|
|
1086
1106
|
const s = new DataView(i, 0), r = s.getUint8(5) & 31;
|
|
1087
1107
|
let o = 6;
|
|
1088
1108
|
for (let c = 0; c < r; c++) {
|
|
@@ -1100,21 +1120,21 @@ const Rr = 7, kr = 8, Pr = (i) => {
|
|
|
1100
1120
|
pictureParameterSets: t
|
|
1101
1121
|
};
|
|
1102
1122
|
}
|
|
1103
|
-
return
|
|
1123
|
+
return Dr(i, (s) => {
|
|
1104
1124
|
const r = s.byteOffset + s.byteLength;
|
|
1105
|
-
switch (
|
|
1106
|
-
case
|
|
1125
|
+
switch (_r(s.getUint8(0))) {
|
|
1126
|
+
case Ur:
|
|
1107
1127
|
t.push(s.buffer.slice(s.byteOffset, r));
|
|
1108
1128
|
break;
|
|
1109
|
-
case
|
|
1129
|
+
case xr:
|
|
1110
1130
|
e.push(s.buffer.slice(s.byteOffset, r));
|
|
1111
1131
|
break;
|
|
1112
1132
|
}
|
|
1113
1133
|
return !0;
|
|
1114
1134
|
}), { sequenceParameterSets: e, pictureParameterSets: t };
|
|
1115
|
-
},
|
|
1135
|
+
}, Or = (i) => {
|
|
1116
1136
|
var E;
|
|
1117
|
-
const e = new DataView(i), t = e.getUint8(1), s = e.getUint8(2), r = e.getUint8(3), o = new
|
|
1137
|
+
const e = new DataView(i), t = e.getUint8(1), s = e.getUint8(2), r = e.getUint8(3), o = new Ns(i, 4 * 8);
|
|
1118
1138
|
o.readUnsignedExpGolomb();
|
|
1119
1139
|
let a = 1;
|
|
1120
1140
|
switch (t) {
|
|
@@ -1130,12 +1150,12 @@ const Rr = 7, kr = 8, Pr = (i) => {
|
|
|
1130
1150
|
case 138:
|
|
1131
1151
|
case 144: {
|
|
1132
1152
|
if (a = o.readUnsignedExpGolomb(), a === 3 && o.readBits(1), o.readUnsignedExpGolomb() + 8, o.readUnsignedExpGolomb() + 8, o.readBit(), o.readBit()) {
|
|
1133
|
-
for (let
|
|
1153
|
+
for (let N = 0; N < (a != 3 ? 8 : 12); N++)
|
|
1134
1154
|
if (o.readBit()) {
|
|
1135
|
-
const
|
|
1136
|
-
let _ = 0,
|
|
1137
|
-
for (let me = 0; me <
|
|
1138
|
-
te != 0 && (_ = o.readSignedExpGolomb(), te = (
|
|
1155
|
+
const M = N < 6 ? 16 : 64;
|
|
1156
|
+
let _ = 0, Z = 8, te = 8;
|
|
1157
|
+
for (let me = 0; me < M; me++)
|
|
1158
|
+
te != 0 && (_ = o.readSignedExpGolomb(), te = (Z + _ + 256) % 256), Z = te == 0 ? Z : te;
|
|
1139
1159
|
}
|
|
1140
1160
|
}
|
|
1141
1161
|
break;
|
|
@@ -1152,14 +1172,14 @@ const Rr = 7, kr = 8, Pr = (i) => {
|
|
|
1152
1172
|
l === 0 && o.readBit(), o.readBit();
|
|
1153
1173
|
let m = h + 1, g = u + 1;
|
|
1154
1174
|
if (g *= 2 - l, g *= 16, m *= 16, o.readBit()) {
|
|
1155
|
-
const
|
|
1156
|
-
m -= _ +
|
|
1175
|
+
const U = a == 1 ? 1 : 0, G = 1 << (a == 1 || a == 2 ? 1 : 0), M = 2 - l << U, _ = o.readUnsignedExpGolomb() * G, Z = o.readUnsignedExpGolomb() * G, te = o.readUnsignedExpGolomb() * M, me = o.readUnsignedExpGolomb() * M;
|
|
1176
|
+
m -= _ + Z, g -= te + me;
|
|
1157
1177
|
}
|
|
1158
1178
|
let p = {
|
|
1159
1179
|
numerator: 1,
|
|
1160
1180
|
denumerator: 1
|
|
1161
1181
|
};
|
|
1162
|
-
return o.readBit() && o.readBit() && (p = (E =
|
|
1182
|
+
return o.readBit() && o.readBit() && (p = (E = Fr[o.readBits(8)]) != null ? E : { numerator: 0, denumerator: 0 }), {
|
|
1163
1183
|
width: m,
|
|
1164
1184
|
height: g,
|
|
1165
1185
|
pixelAspectRatio: p,
|
|
@@ -1167,7 +1187,7 @@ const Rr = 7, kr = 8, Pr = (i) => {
|
|
|
1167
1187
|
constraintFlags: s,
|
|
1168
1188
|
levelIdc: r
|
|
1169
1189
|
};
|
|
1170
|
-
},
|
|
1190
|
+
}, Fr = [
|
|
1171
1191
|
{ numerator: 0, denumerator: 0 },
|
|
1172
1192
|
{ numerator: 1, denumerator: 1 },
|
|
1173
1193
|
{ numerator: 12, denumerator: 11 },
|
|
@@ -1185,20 +1205,20 @@ const Rr = 7, kr = 8, Pr = (i) => {
|
|
|
1185
1205
|
{ numerator: 4, denumerator: 3 },
|
|
1186
1206
|
{ numerator: 3, denumerator: 2 },
|
|
1187
1207
|
{ numerator: 2, denumerator: 1 }
|
|
1188
|
-
],
|
|
1189
|
-
function
|
|
1190
|
-
const e = new
|
|
1191
|
-
t.flags &
|
|
1192
|
-
const s =
|
|
1208
|
+
], Nr = 184549376;
|
|
1209
|
+
function Vr(i) {
|
|
1210
|
+
const e = new os(i), t = zr(e);
|
|
1211
|
+
t.flags & Nr && Hr(e);
|
|
1212
|
+
const s = Qr(e);
|
|
1193
1213
|
if (String.fromCharCode(...s.frameId) === "TXXX") {
|
|
1194
|
-
const o = new
|
|
1214
|
+
const o = new os(e.readBytes(s.size));
|
|
1195
1215
|
return {
|
|
1196
1216
|
header: t,
|
|
1197
|
-
txx:
|
|
1217
|
+
txx: Xr(o)
|
|
1198
1218
|
};
|
|
1199
1219
|
}
|
|
1200
1220
|
}
|
|
1201
|
-
function
|
|
1221
|
+
function zr(i) {
|
|
1202
1222
|
const e = i.readBytes(3), t = i.readUint8(), s = i.readUint8(), r = i.readUint8(), o = i.readUint32();
|
|
1203
1223
|
return {
|
|
1204
1224
|
id: e,
|
|
@@ -1208,11 +1228,11 @@ function Fr(i) {
|
|
|
1208
1228
|
size: o
|
|
1209
1229
|
};
|
|
1210
1230
|
}
|
|
1211
|
-
function
|
|
1231
|
+
function Hr(i) {
|
|
1212
1232
|
const e = i.readUint32();
|
|
1213
1233
|
return i.readBytes(e - 4), {};
|
|
1214
1234
|
}
|
|
1215
|
-
function
|
|
1235
|
+
function Qr(i) {
|
|
1216
1236
|
const e = i.readBytes(4), t = i.readUint32(), s = i.readUint16();
|
|
1217
1237
|
return {
|
|
1218
1238
|
frameId: e,
|
|
@@ -1220,7 +1240,7 @@ function Vr(i) {
|
|
|
1220
1240
|
flags: s
|
|
1221
1241
|
};
|
|
1222
1242
|
}
|
|
1223
|
-
function
|
|
1243
|
+
function Xr(i) {
|
|
1224
1244
|
const e = i.readUint8(), t = i.readUtf8String(), s = i.readUtf8String();
|
|
1225
1245
|
return {
|
|
1226
1246
|
encoding: e,
|
|
@@ -1228,54 +1248,54 @@ function zr(i) {
|
|
|
1228
1248
|
value: s
|
|
1229
1249
|
};
|
|
1230
1250
|
}
|
|
1231
|
-
function
|
|
1251
|
+
function b(i) {
|
|
1232
1252
|
const e = new ArrayBuffer(i.length), t = new Uint8Array(e);
|
|
1233
1253
|
for (let s = 0, r = i.length; s < r; s++)
|
|
1234
1254
|
t[s] = i.charCodeAt(s);
|
|
1235
1255
|
return new Uint8Array(e);
|
|
1236
1256
|
}
|
|
1237
1257
|
const k = {
|
|
1238
|
-
ftyp:
|
|
1239
|
-
mvhd:
|
|
1240
|
-
moov:
|
|
1241
|
-
trak:
|
|
1242
|
-
tkhd:
|
|
1243
|
-
mdia:
|
|
1244
|
-
mdhd:
|
|
1245
|
-
hdlr:
|
|
1246
|
-
minf:
|
|
1247
|
-
vmhd:
|
|
1248
|
-
smhd:
|
|
1249
|
-
dinf:
|
|
1250
|
-
dref:
|
|
1251
|
-
stbl:
|
|
1252
|
-
stsd:
|
|
1253
|
-
avc1:
|
|
1254
|
-
av01:
|
|
1255
|
-
av1C:
|
|
1256
|
-
avcC:
|
|
1257
|
-
esds:
|
|
1258
|
-
colr:
|
|
1259
|
-
nclx:
|
|
1260
|
-
mvex:
|
|
1261
|
-
trex:
|
|
1262
|
-
udta:
|
|
1263
|
-
meta:
|
|
1264
|
-
ilst:
|
|
1265
|
-
moof:
|
|
1266
|
-
mfhd:
|
|
1267
|
-
traf:
|
|
1268
|
-
tfhd:
|
|
1269
|
-
tfdt:
|
|
1270
|
-
trun:
|
|
1271
|
-
mdat:
|
|
1272
|
-
mp4a:
|
|
1273
|
-
Opus:
|
|
1274
|
-
prft:
|
|
1275
|
-
dOps:
|
|
1276
|
-
emsg:
|
|
1277
|
-
},
|
|
1278
|
-
|
|
1258
|
+
ftyp: b("ftyp"),
|
|
1259
|
+
mvhd: b("mvhd"),
|
|
1260
|
+
moov: b("moov"),
|
|
1261
|
+
trak: b("trak"),
|
|
1262
|
+
tkhd: b("tkhd"),
|
|
1263
|
+
mdia: b("mdia"),
|
|
1264
|
+
mdhd: b("mdhd"),
|
|
1265
|
+
hdlr: b("hdlr"),
|
|
1266
|
+
minf: b("minf"),
|
|
1267
|
+
vmhd: b("vmhd"),
|
|
1268
|
+
smhd: b("smhd"),
|
|
1269
|
+
dinf: b("dinf"),
|
|
1270
|
+
dref: b("dref"),
|
|
1271
|
+
stbl: b("stbl"),
|
|
1272
|
+
stsd: b("stsd"),
|
|
1273
|
+
avc1: b("avc1"),
|
|
1274
|
+
av01: b("av01"),
|
|
1275
|
+
av1C: b("av1C"),
|
|
1276
|
+
avcC: b("avcC"),
|
|
1277
|
+
esds: b("esds"),
|
|
1278
|
+
colr: b("colr"),
|
|
1279
|
+
nclx: b("nclx"),
|
|
1280
|
+
mvex: b("mvex"),
|
|
1281
|
+
trex: b("trex"),
|
|
1282
|
+
udta: b("udta"),
|
|
1283
|
+
meta: b("meta"),
|
|
1284
|
+
ilst: b("ilst"),
|
|
1285
|
+
moof: b("moof"),
|
|
1286
|
+
mfhd: b("mfhd"),
|
|
1287
|
+
traf: b("traf"),
|
|
1288
|
+
tfhd: b("tfhd"),
|
|
1289
|
+
tfdt: b("tfdt"),
|
|
1290
|
+
trun: b("trun"),
|
|
1291
|
+
mdat: b("mdat"),
|
|
1292
|
+
mp4a: b("mp4a"),
|
|
1293
|
+
Opus: b("Opus"),
|
|
1294
|
+
prft: b("prft"),
|
|
1295
|
+
dOps: b("dOps"),
|
|
1296
|
+
emsg: b("emsg")
|
|
1297
|
+
}, Gr = 1e3, bt = b("iso6"), vs = new Uint8Array([0, 0, 2, 0]), Wr = [
|
|
1298
|
+
bt,
|
|
1279
1299
|
new Uint8Array([105, 115, 111, 109]),
|
|
1280
1300
|
// isom
|
|
1281
1301
|
new Uint8Array([105, 115, 111, 50]),
|
|
@@ -1284,8 +1304,8 @@ const k = {
|
|
|
1284
1304
|
// avc1
|
|
1285
1305
|
new Uint8Array([109, 112, 52, 49])
|
|
1286
1306
|
// mp41
|
|
1287
|
-
],
|
|
1288
|
-
|
|
1307
|
+
], jr = [
|
|
1308
|
+
bt,
|
|
1289
1309
|
new Uint8Array([105, 115, 111, 109]),
|
|
1290
1310
|
// isom
|
|
1291
1311
|
new Uint8Array([105, 115, 111, 50]),
|
|
@@ -1294,8 +1314,8 @@ const k = {
|
|
|
1294
1314
|
// av01
|
|
1295
1315
|
new Uint8Array([109, 112, 52, 49])
|
|
1296
1316
|
// mp41
|
|
1297
|
-
],
|
|
1298
|
-
|
|
1317
|
+
], qr = [
|
|
1318
|
+
bt,
|
|
1299
1319
|
new Uint8Array([105, 115, 111, 109]),
|
|
1300
1320
|
// isom
|
|
1301
1321
|
new Uint8Array([105, 115, 111, 50]),
|
|
@@ -1303,22 +1323,22 @@ const k = {
|
|
|
1303
1323
|
new Uint8Array([109, 112, 52, 49])
|
|
1304
1324
|
// mp41
|
|
1305
1325
|
];
|
|
1306
|
-
class
|
|
1326
|
+
class en {
|
|
1307
1327
|
constructor() {
|
|
1308
|
-
n(this, "writer", new
|
|
1328
|
+
n(this, "writer", new Fn());
|
|
1309
1329
|
}
|
|
1310
1330
|
}
|
|
1311
|
-
const
|
|
1331
|
+
const H = (i, e, t) => {
|
|
1312
1332
|
i.writer.writeUint32(t + 8), i.writer.writeBytes(e);
|
|
1313
1333
|
}, X = (i, e, t, s, r) => {
|
|
1314
|
-
|
|
1315
|
-
},
|
|
1316
|
-
|
|
1334
|
+
H(i, e, t + 4), i.writer.writeUint8(s), i.writer.writeUint24(r);
|
|
1335
|
+
}, Ti = (i, e) => {
|
|
1336
|
+
H(
|
|
1317
1337
|
i,
|
|
1318
1338
|
k.ftyp,
|
|
1319
|
-
|
|
1320
|
-
), i.writer.writeBytes(
|
|
1321
|
-
},
|
|
1339
|
+
bt.byteLength + vs.byteLength + e.reduce((t, s) => t + s.byteLength, 0)
|
|
1340
|
+
), i.writer.writeBytes(bt), i.writer.writeBytes(vs), e.forEach((t) => i.writer.writeBytes(t));
|
|
1341
|
+
}, Zr = (i, e, t) => {
|
|
1322
1342
|
X(i, k.mvhd, 96, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(t), i.writer.writeUint32(e), i.writer.writeUint32(65536), i.writer.writeUint16(256), i.writer.writeBytes(new Uint8Array([
|
|
1323
1343
|
// reserved and unused junk
|
|
1324
1344
|
0,
|
|
@@ -1392,9 +1412,9 @@ const z = (i, e, t) => {
|
|
|
1392
1412
|
0,
|
|
1393
1413
|
0
|
|
1394
1414
|
])), i.writer.writeUint32(2);
|
|
1395
|
-
},
|
|
1415
|
+
}, tn = (i) => "sequenceParameterSets" in i, Ui = (i) => "sequenceHeader" in i, Ge = (i) => i.type == "video", gt = (i) => i.type == "audio", Jr = (i, e, t) => {
|
|
1396
1416
|
const s = i.writer.position();
|
|
1397
|
-
X(i, k.tkhd, 0, 0, 3), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(e.trackId), i.writer.writeUint32(0), i.writer.writeUint32(e.duration * t / e.timescale), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint16(0), i.writer.writeUint16(
|
|
1417
|
+
X(i, k.tkhd, 0, 0, 3), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(e.trackId), i.writer.writeUint32(0), i.writer.writeUint32(e.duration * t / e.timescale), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint16(0), i.writer.writeUint16(gt(e) ? 1 : 0), i.writer.writeUint16(gt(e) ? 256 : 0), i.writer.writeUint16(0), i.writer.writeBytes(new Uint8Array(
|
|
1398
1418
|
[
|
|
1399
1419
|
0,
|
|
1400
1420
|
1,
|
|
@@ -1433,46 +1453,46 @@ const z = (i, e, t) => {
|
|
|
1433
1453
|
0,
|
|
1434
1454
|
0
|
|
1435
1455
|
]
|
|
1436
|
-
)), Ge(e) ? (i.writer.writeUint32(e.width * 65536), i.writer.writeUint32(e.height * 65536)) :
|
|
1437
|
-
},
|
|
1456
|
+
)), Ge(e) ? (i.writer.writeUint32(e.width * 65536), i.writer.writeUint32(e.height * 65536)) : gt(e) && (i.writer.writeUint32(0), i.writer.writeUint32(0)), i.writer.writeUint32At(s, i.writer.position() - s);
|
|
1457
|
+
}, Yr = (i, e) => {
|
|
1438
1458
|
X(i, k.mdhd, 20, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(e.timescale), i.writer.writeUint32(e.duration);
|
|
1439
1459
|
const t = e.lang || "und", s = (t.charCodeAt(0) & 31) << 10 | (t.charCodeAt(1) & 31) << 5 | t.charCodeAt(2) & 31;
|
|
1440
1460
|
i.writer.writeUint16(s), i.writer.writeUint16(0);
|
|
1441
|
-
},
|
|
1461
|
+
}, Kr = (i, e) => {
|
|
1442
1462
|
const t = i.writer.position();
|
|
1443
|
-
X(i, k.hdlr, 0, 0, 0), i.writer.writeUint32(0), i.writer.writeBytes(
|
|
1444
|
-
},
|
|
1463
|
+
X(i, k.hdlr, 0, 0, 0), i.writer.writeUint32(0), i.writer.writeBytes(b(Ge(e) ? "vide" : "soun")), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeBytes(b(Ge(e) ? "VideoHandler\0" : "SoundHandler\0")), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1464
|
+
}, $r = (i) => {
|
|
1445
1465
|
const e = i.writer.position();
|
|
1446
|
-
|
|
1447
|
-
},
|
|
1466
|
+
H(i, k.dinf, 0), X(i, k.dref, 16, 0, 0), i.writer.writeUint32(1), X(i, b("url "), 0, 0, 1), i.writer.writeUint32At(e, i.writer.position() - e);
|
|
1467
|
+
}, eo = (i, e) => {
|
|
1448
1468
|
const t = i.writer.position();
|
|
1449
|
-
|
|
1469
|
+
H(i, k.avcC, 0), i.writer.writeUint8(1), i.writer.writeUint8(e.sequenceParameterSets[0][1]), i.writer.writeUint8(e.sequenceParameterSets[0][2]), i.writer.writeUint8(e.sequenceParameterSets[0][3]), i.writer.writeUint8(255), i.writer.writeUint8(224 | e.sequenceParameterSets.length), e.sequenceParameterSets.forEach((s) => {
|
|
1450
1470
|
i.writer.writeUint16(s.byteLength), i.writer.writeBytes(s);
|
|
1451
1471
|
}), i.writer.writeUint8(e.pictureParameterSets.length), e.pictureParameterSets.forEach((s) => {
|
|
1452
1472
|
i.writer.writeUint16(s.byteLength), i.writer.writeBytes(s);
|
|
1453
1473
|
}), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1454
|
-
},
|
|
1474
|
+
}, to = (i, e) => {
|
|
1455
1475
|
var c, h;
|
|
1456
1476
|
const t = i.writer.position();
|
|
1457
|
-
|
|
1477
|
+
H(i, k.av1C, 0);
|
|
1458
1478
|
const { seqProfile: s, operatingPoints: r, colorConfig: o } = e.parsedSequenceHeader, a = r[0];
|
|
1459
1479
|
i.writer.writeUint8(129), i.writer.writeUint8(s << 5 | ((c = a == null ? void 0 : a.seqLevelIdx) != null ? c : 0)), i.writer.writeUint8(
|
|
1460
1480
|
((h = a == null ? void 0 : a.tier) != null ? h : 0) | (o.highBitDepth ? 1 : 0) | (o.bitDepth === 12 ? 1 : 0) << 5 | (o.monoChrome ? 1 : 0) << 4 | o.subsamplingX << 3 | o.subsamplingY << 2 | o.chromaSamplePosition & 65535
|
|
1461
1481
|
), i.writer.writeUint8(0), i.writer.writeBytes(e.sequenceHeader), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1462
|
-
},
|
|
1463
|
-
const t = i.writer.position(), s =
|
|
1464
|
-
|
|
1465
|
-
},
|
|
1482
|
+
}, io = (i, e) => {
|
|
1483
|
+
const t = i.writer.position(), s = Ui(e) ? k.av01 : k.avc1;
|
|
1484
|
+
H(i, s, 0), i.writer.writeUint32(0), i.writer.writeUint16(0), i.writer.writeUint16(1), i.writer.writeUint16(0), i.writer.writeUint16(0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint16(e.width), i.writer.writeUint16(e.height), i.writer.writeUint32(4718592), i.writer.writeUint32(4718592), i.writer.writeUint32(0), i.writer.writeUint16(1), i.writer.writeUint8(0), i.writer.writeBytes(new Uint8Array(31)), i.writer.writeUint16(24), i.writer.writeUint16(-1), tn(e) ? eo(i, e) : Ui(e) && (to(i, e), e.parsedSequenceHeader.colorConfig && (H(i, b("colr"), 11), i.writer.writeBytes(k.nclx), i.writer.writeUint16(e.parsedSequenceHeader.colorConfig.colorPrimaries), i.writer.writeUint16(e.parsedSequenceHeader.colorConfig.transferCharacteristics), i.writer.writeUint16(e.parsedSequenceHeader.colorConfig.matrixCoefficients), i.writer.writeUint8(e.parsedSequenceHeader.colorConfig.colorRange ? 1 : 0))), e.pixelAspectRatio && (H(i, b("pasp"), 8), i.writer.writeUint32(e.pixelAspectRatio.numerator), i.writer.writeUint32(e.pixelAspectRatio.denumerator)), e.bitrate && (H(i, b("btrt"), 12), i.writer.writeUint32(0), i.writer.writeUint32(e.bitrate), i.writer.writeUint32(e.bitrate)), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1485
|
+
}, Dt = (i, e, t) => {
|
|
1466
1486
|
let s = 3;
|
|
1467
1487
|
for (i.writer.writeUint8(e); s > 0; s--)
|
|
1468
1488
|
i.writer.writeUint8(t >> 7 * s | 128);
|
|
1469
1489
|
i.writer.writeUint8(t & 127);
|
|
1470
|
-
},
|
|
1490
|
+
}, so = (i, e) => {
|
|
1471
1491
|
const t = e.decoderConfig.byteLength > 0 ? e.decoderConfig.byteLength + 5 : 0, s = i.writer.position();
|
|
1472
|
-
X(i, k.esds, 0, 0, 0),
|
|
1492
|
+
X(i, k.esds, 0, 0, 0), Dt(i, 3, 21 + t + 5 + 1), i.writer.writeUint16(e.trackId), i.writer.writeUint8(0), Dt(i, 4, 13 + t);
|
|
1473
1493
|
const r = e.codec === "mp3" && e.sampleRate > 24e3 ? 107 : 64;
|
|
1474
|
-
i.writer.writeUint8(r), i.writer.writeUint8(21), i.writer.writeUint24(0), i.writer.writeUint32(e.bitrate || 0), i.writer.writeUint32(e.bitrate || 0), e.decoderConfig.byteLength > 0 && (
|
|
1475
|
-
},
|
|
1494
|
+
i.writer.writeUint8(r), i.writer.writeUint8(21), i.writer.writeUint24(0), i.writer.writeUint32(e.bitrate || 0), i.writer.writeUint32(e.bitrate || 0), e.decoderConfig.byteLength > 0 && (Dt(i, 5, e.decoderConfig.byteLength), i.writer.writeBytes(e.decoderConfig)), Dt(i, 6, 1), i.writer.writeUint8(2), i.writer.writeUint32At(s, i.writer.position() - s);
|
|
1495
|
+
}, no = (i) => {
|
|
1476
1496
|
switch (i) {
|
|
1477
1497
|
case "aac":
|
|
1478
1498
|
case "mp3":
|
|
@@ -1480,80 +1500,80 @@ const z = (i, e, t) => {
|
|
|
1480
1500
|
case "opus":
|
|
1481
1501
|
return "Opus";
|
|
1482
1502
|
}
|
|
1483
|
-
},
|
|
1503
|
+
}, ro = (i, e) => {
|
|
1484
1504
|
const t = i.writer.position();
|
|
1485
|
-
|
|
1505
|
+
H(i, b("dOps"), 0), i.writer.writeUint8(0);
|
|
1486
1506
|
const s = e.decoderConfig, r = new DataView(s.buffer, s.byteOffset, s.byteLength);
|
|
1487
1507
|
i.writer.writeUint8(r.getUint8(9)), i.writer.writeUint16(r.getUint16(10, !0)), i.writer.writeUint32(r.getUint32(12, !0)), i.writer.writeUint16(r.getUint16(16, !0)), i.writer.writeBytes(e.decoderConfig.slice(18)), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1488
|
-
},
|
|
1508
|
+
}, oo = (i, e) => {
|
|
1489
1509
|
const t = i.writer.position();
|
|
1490
|
-
switch (
|
|
1510
|
+
switch (H(i, b(no(e.codec)), 0), i.writer.writeUint32(0), i.writer.writeUint16(0), i.writer.writeUint16(1), i.writer.writeUint16(0), i.writer.writeUint16(0), i.writer.writeUint32(0), i.writer.writeUint16(e.channelCount), i.writer.writeUint16(16), i.writer.writeUint32(0), i.writer.writeUint16(e.sampleRate), i.writer.writeUint16(0), e.codec) {
|
|
1491
1511
|
case "aac":
|
|
1492
1512
|
case "mp3":
|
|
1493
|
-
|
|
1513
|
+
so(i, e);
|
|
1494
1514
|
break;
|
|
1495
1515
|
case "opus":
|
|
1496
|
-
|
|
1516
|
+
ro(i, e);
|
|
1497
1517
|
break;
|
|
1498
1518
|
}
|
|
1499
|
-
e.bitrate && (
|
|
1500
|
-
},
|
|
1519
|
+
e.bitrate && (H(i, b("btrt"), 12), i.writer.writeUint32(0), i.writer.writeUint32(e.bitrate), i.writer.writeUint32(e.bitrate)), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1520
|
+
}, ao = (i, e) => {
|
|
1501
1521
|
const t = i.writer.position();
|
|
1502
|
-
|
|
1522
|
+
H(i, k.stbl, 0);
|
|
1503
1523
|
const s = i.writer.position();
|
|
1504
|
-
X(i, k.stsd, 0, 0, 0), i.writer.writeUint32(1), Ge(e) ?
|
|
1505
|
-
},
|
|
1524
|
+
X(i, k.stsd, 0, 0, 0), i.writer.writeUint32(1), Ge(e) ? io(i, e) : gt(e) && oo(i, e), i.writer.writeUint32At(s, i.writer.position() - s), X(i, b("stts"), 4, 0, 0), i.writer.writeUint32(0), X(i, b("stsc"), 4, 0, 0), i.writer.writeUint32(0), X(i, b("stsz"), 8, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32(0), X(i, b("stco"), 4, 0, 0), i.writer.writeUint32(0), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1525
|
+
}, co = (i, e) => {
|
|
1506
1526
|
const t = i.writer.position();
|
|
1507
|
-
|
|
1508
|
-
},
|
|
1527
|
+
H(i, k.minf, 0), Ge(e) ? (X(i, k.vmhd, 8, 0, 1), i.writer.writeUint32(0), i.writer.writeUint32(0)) : gt(e) && (X(i, k.smhd, 4, 0, 0), i.writer.writeUint16(0), i.writer.writeUint16(0)), $r(i), ao(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1528
|
+
}, ho = (i, e) => {
|
|
1509
1529
|
const t = i.writer.position();
|
|
1510
|
-
|
|
1511
|
-
},
|
|
1530
|
+
H(i, k.mdia, 0), Yr(i, e), Kr(i, e), co(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1531
|
+
}, uo = (i, e, t) => {
|
|
1512
1532
|
const s = i.writer.position();
|
|
1513
|
-
|
|
1514
|
-
},
|
|
1533
|
+
H(i, k.trak, 0), Jr(i, e, t), ho(i, e), i.writer.writeUint32At(s, i.writer.position() - s);
|
|
1534
|
+
}, lo = (i, e) => {
|
|
1515
1535
|
X(i, k.trex, 20, 0, 0), i.writer.writeUint32(e.trackId), i.writer.writeUint32(1), i.writer.writeUint32(0), i.writer.writeUint32(0), i.writer.writeUint32(0);
|
|
1516
|
-
},
|
|
1536
|
+
}, mo = (i, e) => {
|
|
1517
1537
|
const t = i.writer.position();
|
|
1518
|
-
|
|
1519
|
-
},
|
|
1538
|
+
H(i, k.mvex, 0), e.forEach((s) => lo(i, s)), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1539
|
+
}, fo = (i, e, t, s) => {
|
|
1520
1540
|
const r = i.writer.position();
|
|
1521
|
-
|
|
1522
|
-
},
|
|
1541
|
+
H(i, k.moov, 0), Zr(i, 0, t), e.forEach((o) => uo(i, o, t)), mo(i, e), i.writer.writeUint32At(r, i.writer.position() - r);
|
|
1542
|
+
}, Ao = (i, e) => {
|
|
1523
1543
|
const t = i.writer.position();
|
|
1524
1544
|
X(i, k.tfhd, 16, 0, 56), i.writer.writeUint32(e.trackId), i.writer.writeUint32(e.defaultDuration || 0), i.writer.writeUint32(e.defaultSize || 0), i.writer.writeUint32(e.defaultFlags || 0), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1525
|
-
},
|
|
1545
|
+
}, go = (i, e) => {
|
|
1526
1546
|
const t = i.writer.position();
|
|
1527
1547
|
X(i, k.tfdt, 8, 1, 0);
|
|
1528
1548
|
const s = Math.floor(e.timestamp / 4294967296), r = (e.timestamp & 4294967295) >>> 0;
|
|
1529
1549
|
i.writer.writeUint32(s), i.writer.writeUint32(r), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1530
|
-
},
|
|
1531
|
-
const t = e.samples.some((c) => !!c.compositionTimeOffset), s =
|
|
1550
|
+
}, po = (i, e) => {
|
|
1551
|
+
const t = e.samples.some((c) => !!c.compositionTimeOffset), s = bs(e.samples[0]) !== e.defaultFlags;
|
|
1532
1552
|
let r = 1;
|
|
1533
1553
|
s && (r |= 4), t && (r |= 2048);
|
|
1534
1554
|
const o = i.writer.position();
|
|
1535
1555
|
X(i, k.trun, 16, 1, r), i.writer.writeUint32(e.samples.length);
|
|
1536
1556
|
const a = i.writer.position();
|
|
1537
|
-
i.writer.writeUint32(0), s && i.writer.writeUint32(
|
|
1538
|
-
},
|
|
1557
|
+
i.writer.writeUint32(0), s && i.writer.writeUint32(bs(e.samples[0])), t && e.samples.forEach((c) => i.writer.writeUint32(c.compositionTimeOffset || 0)), i.writer.writeUint32At(a, i.writer.position() + 8), i.writer.writeUint32At(o, i.writer.position() - o);
|
|
1558
|
+
}, bs = (i) => i.isSync ? 33554432 : 16842752, wo = (i, e) => {
|
|
1539
1559
|
const t = i.writer.position();
|
|
1540
|
-
|
|
1541
|
-
},
|
|
1560
|
+
H(i, k.traf, 0), Ao(i, e), go(i, e), po(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1561
|
+
}, So = (i, e) => {
|
|
1542
1562
|
X(i, k.mfhd, 4, 0, 0), i.writer.writeUint32(e);
|
|
1543
|
-
},
|
|
1563
|
+
}, vo = (i, e) => {
|
|
1544
1564
|
const t = i.writer.position();
|
|
1545
|
-
|
|
1546
|
-
},
|
|
1547
|
-
|
|
1548
|
-
},
|
|
1549
|
-
const t = new
|
|
1550
|
-
return i.filter((o) => Ge(o) &&
|
|
1551
|
-
},
|
|
1552
|
-
const e = new
|
|
1565
|
+
H(i, k.moof, 0), So(i, e.sequenceNumber), wo(i, e), i.writer.writeUint32At(t, i.writer.position() - t);
|
|
1566
|
+
}, bo = (i, e) => {
|
|
1567
|
+
H(i, k.mdat, e.samples[0].data.length), i.writer.writeBytes(e.samples[0].data);
|
|
1568
|
+
}, Si = (i, e) => {
|
|
1569
|
+
const t = new en(), s = i.filter((o) => Ge(o) && tn(o)).length > 0;
|
|
1570
|
+
return i.filter((o) => Ge(o) && Ui(o)).length > 0 ? Ti(t, jr) : s ? Ti(t, Wr) : Ti(t, qr), fo(t, i, Gr), t.writer.buffer();
|
|
1571
|
+
}, vi = (i) => {
|
|
1572
|
+
const e = new en();
|
|
1553
1573
|
if (i.samples.length !== 1)
|
|
1554
1574
|
throw new Error("Only one sample is supported");
|
|
1555
|
-
return
|
|
1556
|
-
},
|
|
1575
|
+
return vo(e, i), bo(e, i), e.writer.buffer();
|
|
1576
|
+
}, yo = ({ isSync: i, timestamp: e, data: t, duration: s }, r) => vi({
|
|
1557
1577
|
trackId: 1,
|
|
1558
1578
|
timestamp: e,
|
|
1559
1579
|
sequenceNumber: r,
|
|
@@ -1567,7 +1587,7 @@ const z = (i, e, t) => {
|
|
|
1567
1587
|
duration: s
|
|
1568
1588
|
}
|
|
1569
1589
|
]
|
|
1570
|
-
}),
|
|
1590
|
+
}), Eo = (i, e, t, s) => Si([
|
|
1571
1591
|
{
|
|
1572
1592
|
type: "audio",
|
|
1573
1593
|
codec: "aac",
|
|
@@ -1578,12 +1598,12 @@ const z = (i, e, t) => {
|
|
|
1578
1598
|
duration: 0,
|
|
1579
1599
|
trackId: 1
|
|
1580
1600
|
}
|
|
1581
|
-
]),
|
|
1582
|
-
const { sequenceParameterSets: e, pictureParameterSets: t } =
|
|
1601
|
+
]), sn = (i) => {
|
|
1602
|
+
const { sequenceParameterSets: e, pictureParameterSets: t } = $s(i), s = e[0], r = t[0];
|
|
1583
1603
|
if (!s || !r)
|
|
1584
1604
|
throw new Error("No sps or pps provided");
|
|
1585
|
-
return
|
|
1586
|
-
},
|
|
1605
|
+
return Or(s);
|
|
1606
|
+
}, To = ({ isSync: i, timestamp: e, data: t, duration: s, compositionTimeOffset: r }, o) => vi({
|
|
1587
1607
|
trackId: 1,
|
|
1588
1608
|
timestamp: e,
|
|
1589
1609
|
sequenceNumber: o,
|
|
@@ -1598,9 +1618,9 @@ const z = (i, e, t) => {
|
|
|
1598
1618
|
compositionTimeOffset: r
|
|
1599
1619
|
}
|
|
1600
1620
|
]
|
|
1601
|
-
}),
|
|
1602
|
-
const { sequenceParameterSets: t, pictureParameterSets: s } =
|
|
1603
|
-
return
|
|
1621
|
+
}), Co = (i, e) => {
|
|
1622
|
+
const { sequenceParameterSets: t, pictureParameterSets: s } = $s(i), r = sn(i);
|
|
1623
|
+
return Si([
|
|
1604
1624
|
{
|
|
1605
1625
|
type: "video",
|
|
1606
1626
|
sequenceParameterSets: t.map((o) => new Uint8Array(o)),
|
|
@@ -1612,7 +1632,7 @@ const z = (i, e, t) => {
|
|
|
1612
1632
|
trackId: 1
|
|
1613
1633
|
}
|
|
1614
1634
|
]);
|
|
1615
|
-
},
|
|
1635
|
+
}, Io = (i, e, t) => Si([
|
|
1616
1636
|
{
|
|
1617
1637
|
type: "audio",
|
|
1618
1638
|
trackId: 1,
|
|
@@ -1623,7 +1643,7 @@ const z = (i, e, t) => {
|
|
|
1623
1643
|
duration: 0,
|
|
1624
1644
|
sampleRate: 48e3
|
|
1625
1645
|
}
|
|
1626
|
-
]),
|
|
1646
|
+
]), Bo = ({ isSync: i, timestamp: e, data: t, duration: s }, r) => vi({
|
|
1627
1647
|
trackId: 1,
|
|
1628
1648
|
timestamp: e,
|
|
1629
1649
|
sequenceNumber: r,
|
|
@@ -1637,10 +1657,10 @@ const z = (i, e, t) => {
|
|
|
1637
1657
|
duration: s
|
|
1638
1658
|
}
|
|
1639
1659
|
]
|
|
1640
|
-
}),
|
|
1641
|
-
const e = new
|
|
1642
|
-
return e.peekBit() === 1 && e.readBits(32),
|
|
1643
|
-
},
|
|
1660
|
+
}), nn = (i) => {
|
|
1661
|
+
const e = new Ns(i);
|
|
1662
|
+
return e.peekBit() === 1 && e.readBits(32), Po(e), Fo(e);
|
|
1663
|
+
}, Ro = (i) => {
|
|
1644
1664
|
let e = 0;
|
|
1645
1665
|
for (let t = 0; t < 8; t++) {
|
|
1646
1666
|
const s = i.readBits(8);
|
|
@@ -1648,37 +1668,37 @@ const z = (i, e, t) => {
|
|
|
1648
1668
|
break;
|
|
1649
1669
|
}
|
|
1650
1670
|
return e;
|
|
1651
|
-
},
|
|
1671
|
+
}, ko = (i) => {
|
|
1652
1672
|
let e = 0;
|
|
1653
1673
|
for (; e < 100 && i.readBit() === 0; )
|
|
1654
1674
|
e++;
|
|
1655
1675
|
return e >= 32 ? 0 : i.readBits(e) + (1 << e) - 1;
|
|
1656
|
-
},
|
|
1676
|
+
}, Po = (i) => {
|
|
1657
1677
|
const e = i.readBits(8);
|
|
1658
1678
|
if ((e >> 7 & 1) !== 0)
|
|
1659
1679
|
return;
|
|
1660
1680
|
const s = e >> 3 & 15, r = e >> 2 & 1, o = e >> 1 & 1;
|
|
1661
|
-
return r == 1 && i.readBits(8), o == 1 &&
|
|
1681
|
+
return r == 1 && i.readBits(8), o == 1 && Ro(i), {
|
|
1662
1682
|
headerLength: 1 + r,
|
|
1663
1683
|
type: s
|
|
1664
1684
|
};
|
|
1665
|
-
},
|
|
1685
|
+
}, xo = (i) => {
|
|
1666
1686
|
const e = i.readBits(32), t = i.readBits(32), s = i.readBit() !== 0;
|
|
1667
1687
|
let r = 0;
|
|
1668
|
-
return s && (r =
|
|
1688
|
+
return s && (r = ko(i) + 1), {
|
|
1669
1689
|
timescale: t,
|
|
1670
1690
|
equalPictureInterval: s,
|
|
1671
1691
|
numUnitsInDisplayTick: e,
|
|
1672
1692
|
numTicksPerPicture: r
|
|
1673
1693
|
};
|
|
1674
|
-
},
|
|
1694
|
+
}, ys = 2, Ci = 2, Uo = 1, Lo = 2, Mo = 2, _o = 13, Do = 0, Oo = 2, Es = 0, Fo = (i) => {
|
|
1675
1695
|
const e = i.readBits(3), s = i.readBit() !== 0, r = i.readBit() !== 0;
|
|
1676
1696
|
let o, a = !1, c = !1, h = !1, u = 0, l = 0;
|
|
1677
1697
|
const m = [];
|
|
1678
1698
|
if (r)
|
|
1679
1699
|
i.readBits(5);
|
|
1680
1700
|
else {
|
|
1681
|
-
if (c = i.readBit() !== 0, c && (o =
|
|
1701
|
+
if (c = i.readBit() !== 0, c && (o = xo(i), a = i.readBit() !== 0, a))
|
|
1682
1702
|
throw new Error("Not implemented");
|
|
1683
1703
|
h = i.readBit() !== 0;
|
|
1684
1704
|
const C = i.readBits(5) + 1;
|
|
@@ -1690,13 +1710,13 @@ const z = (i, e, t) => {
|
|
|
1690
1710
|
h && i.readBit() !== 0 && i.readBits(4), m.push({ tier: Q, operatingPointIdc: ie, seqLevelIdx: O });
|
|
1691
1711
|
}
|
|
1692
1712
|
}
|
|
1693
|
-
const g = i.readBits(4) + 1, p = i.readBits(4) + 1, E = i.readBits(g) + 1,
|
|
1694
|
-
let
|
|
1695
|
-
r ?
|
|
1696
|
-
const G = i.readBit() !== 0,
|
|
1697
|
-
let
|
|
1698
|
-
r || (
|
|
1699
|
-
const
|
|
1713
|
+
const g = i.readBits(4) + 1, p = i.readBits(4) + 1, E = i.readBits(g) + 1, U = i.readBits(p) + 1;
|
|
1714
|
+
let N = !1;
|
|
1715
|
+
r ? N = !1 : N = i.readBit() !== 0, N && (u = i.readBits(4) + 2, l = i.readBits(3) + 1);
|
|
1716
|
+
const G = i.readBit() !== 0, M = i.readBit() !== 0, _ = i.readBit() !== 0;
|
|
1717
|
+
let Z = !1, te = !1, me = !1, Lt = !1, fe = !1, lt = !1, Mt = !1, xe = ys, Ue = Ci, f = 0;
|
|
1718
|
+
r || (Z = i.readBit() !== 0, te = i.readBit() !== 0, me = i.readBit() !== 0, Lt = i.readBit() !== 0, fe = i.readBit() !== 0, fe && (lt = i.readBit() !== 0, Mt = i.readBit() !== 0), i.readBit() !== 0 ? xe = ys : xe = i.readBit(), xe > 0 ? i.readBit() > 0 ? Ue = Ci : Ue = i.readBit() : Ue = Ci, fe ? f = i.readBits(3) : f = 0);
|
|
1719
|
+
const v = i.readBit() !== 0, x = i.readBit() !== 0, P = i.readBit() !== 0;
|
|
1700
1720
|
return {
|
|
1701
1721
|
seqProfile: e,
|
|
1702
1722
|
stillPicture: s,
|
|
@@ -1714,36 +1734,36 @@ const z = (i, e, t) => {
|
|
|
1714
1734
|
frameWidthBits: g,
|
|
1715
1735
|
frameHeightBits: p,
|
|
1716
1736
|
maxFrameWidth: E,
|
|
1717
|
-
maxFrameHeight:
|
|
1718
|
-
frameIdNumbersPresentFlag:
|
|
1737
|
+
maxFrameHeight: U,
|
|
1738
|
+
frameIdNumbersPresentFlag: N,
|
|
1719
1739
|
deltaFrameIdLength: u,
|
|
1720
1740
|
additionalFrameIdLength: l,
|
|
1721
1741
|
use_128x128Superblock: G,
|
|
1722
|
-
enableFilterIntra:
|
|
1742
|
+
enableFilterIntra: M,
|
|
1723
1743
|
enableIntraEdgeFilter: _,
|
|
1724
|
-
enableInterintraCompound:
|
|
1744
|
+
enableInterintraCompound: Z,
|
|
1725
1745
|
enableMaskedCompound: te,
|
|
1726
1746
|
enableWarpedMotion: me,
|
|
1727
|
-
enableDualFilter:
|
|
1728
|
-
enableOrderHint:
|
|
1747
|
+
enableDualFilter: Lt,
|
|
1748
|
+
enableOrderHint: fe,
|
|
1729
1749
|
enableJntComp: lt,
|
|
1730
1750
|
enableRefFrameMvs: Mt,
|
|
1731
1751
|
seqForceScreenContentTools: xe,
|
|
1732
1752
|
seqForceIntegerMv: Ue,
|
|
1733
|
-
orderHintBits:
|
|
1734
|
-
enableSuperres:
|
|
1735
|
-
enableCdef:
|
|
1736
|
-
enableRestoration:
|
|
1737
|
-
colorConfig:
|
|
1753
|
+
orderHintBits: f,
|
|
1754
|
+
enableSuperres: v,
|
|
1755
|
+
enableCdef: x,
|
|
1756
|
+
enableRestoration: P,
|
|
1757
|
+
colorConfig: No(i, e),
|
|
1738
1758
|
filmGrainParamsPresent: i.readBit() !== 0
|
|
1739
1759
|
};
|
|
1740
|
-
},
|
|
1760
|
+
}, No = (i, e) => {
|
|
1741
1761
|
const t = i.readBit() !== 0;
|
|
1742
1762
|
let s = 8, r = !1;
|
|
1743
1763
|
e === 2 && t ? s = i.readBit() !== 0 ? 12 : 10 : e <= 2 && (s = t ? 10 : 8), e === 1 ? r = !1 : r = i.readBit() !== 0;
|
|
1744
1764
|
const o = r ? 1 : 3, a = i.readBit() !== 0;
|
|
1745
|
-
let c =
|
|
1746
|
-
return a && (c = i.readBits(8), h = i.readBits(8), u = i.readBits(8)), r ? (l = i.readBit() !== 0, m = 1, g = 1, p =
|
|
1765
|
+
let c = Lo, h = Mo, u = Oo, l = !1, m = 0, g = 0, p = Es, E = !1;
|
|
1766
|
+
return a && (c = i.readBits(8), h = i.readBits(8), u = i.readBits(8)), r ? (l = i.readBit() !== 0, m = 1, g = 1, p = Es, E = !1, {
|
|
1747
1767
|
highBitDepth: t,
|
|
1748
1768
|
bitDepth: s,
|
|
1749
1769
|
monoChrome: r,
|
|
@@ -1756,7 +1776,7 @@ const z = (i, e, t) => {
|
|
|
1756
1776
|
subsamplingX: m,
|
|
1757
1777
|
subsamplingY: g,
|
|
1758
1778
|
transferCharacteristics: h
|
|
1759
|
-
}) : c ===
|
|
1779
|
+
}) : c === Uo && h == _o && u == Do ? (l = !0, m = 0, g = 0, {
|
|
1760
1780
|
highBitDepth: t,
|
|
1761
1781
|
bitDepth: s,
|
|
1762
1782
|
monoChrome: r,
|
|
@@ -1783,14 +1803,14 @@ const z = (i, e, t) => {
|
|
|
1783
1803
|
subsamplingY: g,
|
|
1784
1804
|
transferCharacteristics: h
|
|
1785
1805
|
});
|
|
1786
|
-
},
|
|
1787
|
-
const e =
|
|
1806
|
+
}, Vo = (i) => {
|
|
1807
|
+
const e = nn(i);
|
|
1788
1808
|
if (e)
|
|
1789
1809
|
return {
|
|
1790
1810
|
width: e.maxFrameWidth,
|
|
1791
1811
|
height: e.maxFrameHeight
|
|
1792
1812
|
};
|
|
1793
|
-
},
|
|
1813
|
+
}, zo = ({ isSync: i, timestamp: e, data: t, duration: s, compositionTimeOffset: r }, o) => vi({
|
|
1794
1814
|
trackId: 1,
|
|
1795
1815
|
timestamp: e,
|
|
1796
1816
|
sequenceNumber: o,
|
|
@@ -1805,11 +1825,11 @@ const z = (i, e, t) => {
|
|
|
1805
1825
|
compositionTimeOffset: r
|
|
1806
1826
|
}
|
|
1807
1827
|
]
|
|
1808
|
-
}),
|
|
1809
|
-
const t =
|
|
1828
|
+
}), Ho = (i, e) => {
|
|
1829
|
+
const t = nn(i);
|
|
1810
1830
|
if (!t)
|
|
1811
1831
|
throw new Error("Failed to parse sequence header");
|
|
1812
|
-
return
|
|
1832
|
+
return Si([
|
|
1813
1833
|
{
|
|
1814
1834
|
type: "video",
|
|
1815
1835
|
parsedSequenceHeader: t,
|
|
@@ -1821,44 +1841,44 @@ const z = (i, e, t) => {
|
|
|
1821
1841
|
trackId: 1
|
|
1822
1842
|
}
|
|
1823
1843
|
]);
|
|
1824
|
-
},
|
|
1844
|
+
}, Qo = (i, e, t) => {
|
|
1825
1845
|
switch (i) {
|
|
1826
1846
|
case "h264":
|
|
1827
|
-
return
|
|
1847
|
+
return Go(e, t);
|
|
1828
1848
|
case "av1":
|
|
1829
|
-
return
|
|
1849
|
+
return Wo(e, t);
|
|
1830
1850
|
case "opus":
|
|
1831
|
-
return
|
|
1851
|
+
return jo(e, t);
|
|
1832
1852
|
case "aac":
|
|
1833
|
-
return
|
|
1853
|
+
return qo(e, t);
|
|
1834
1854
|
default:
|
|
1835
1855
|
throw new Error(`Failed to initialize ${i} segment`);
|
|
1836
1856
|
}
|
|
1837
|
-
},
|
|
1857
|
+
}, Xo = (i, e) => {
|
|
1838
1858
|
switch (i) {
|
|
1839
1859
|
case "h264":
|
|
1840
|
-
return
|
|
1860
|
+
return sn(e);
|
|
1841
1861
|
case "av1":
|
|
1842
|
-
return
|
|
1862
|
+
return Vo(e);
|
|
1843
1863
|
}
|
|
1844
|
-
},
|
|
1864
|
+
}, Go = (i, e) => Co(i, e), Wo = (i, e) => Ho(i, e), jo = (i, e) => Io(new Uint8Array(i), 2, e), qo = (i, e) => Eo(new Uint8Array(i), 2, e, e), Zo = (i, e) => {
|
|
1845
1865
|
switch (i.codec) {
|
|
1846
1866
|
case "h264":
|
|
1847
|
-
return bo(i, e);
|
|
1848
|
-
case "opus":
|
|
1849
1867
|
return To(i, e);
|
|
1868
|
+
case "opus":
|
|
1869
|
+
return Bo(i, e);
|
|
1850
1870
|
case "aac":
|
|
1851
|
-
return
|
|
1871
|
+
return yo(i, e);
|
|
1852
1872
|
case "av1":
|
|
1853
|
-
return
|
|
1873
|
+
return zo(i, e);
|
|
1854
1874
|
default:
|
|
1855
1875
|
throw new Error(`Unsupported codec ${i.codec}`);
|
|
1856
1876
|
}
|
|
1857
|
-
},
|
|
1858
|
-
const e = new DataView(i, 0), t = e.getUint8(0), s = e.getUint16(1), r = e.getUint8(3), o = e.getUint8(4), a =
|
|
1877
|
+
}, pt = (i) => !!(i & 1), Jo = (i) => !!(i & 2), Yo = (i) => !!(i & 4), Ko = (i) => !!(i & 8), $o = (i) => !!(i & 16), ea = (i) => {
|
|
1878
|
+
const e = new DataView(i, 0), t = e.getUint8(0), s = e.getUint16(1), r = e.getUint8(3), o = e.getUint8(4), a = zs(new Uint8Array(i), 5, 12), c = e.getUint32(13), h = $o(r) ? e.getInt16(17) : void 0, u = i.slice(s);
|
|
1859
1879
|
return { version: t, renditionId: o, flags: r, timestamp: a, timescale: c, payload: u, compositionTimeOffset: h };
|
|
1860
|
-
},
|
|
1861
|
-
class
|
|
1880
|
+
}, ta = "data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw", Ot = () => "wakeLock" in navigator && window.navigator.userAgent.indexOf("Samsung") === -1;
|
|
1881
|
+
class ia {
|
|
1862
1882
|
constructor() {
|
|
1863
1883
|
n(this, "enabled", !1);
|
|
1864
1884
|
n(this, "wakeLockVideo");
|
|
@@ -1866,7 +1886,7 @@ class $o {
|
|
|
1866
1886
|
n(this, "handleVisibilityChange", () => {
|
|
1867
1887
|
this._wakeLock !== null && document.visibilityState === "visible" && this.enable();
|
|
1868
1888
|
});
|
|
1869
|
-
|
|
1889
|
+
Ot() && (this._wakeLock = null, document.addEventListener("visibilitychange", this.handleVisibilityChange), document.addEventListener("fullscreenchange", this.handleVisibilityChange));
|
|
1870
1890
|
}
|
|
1871
1891
|
_addSourceToVideo(e, t, s) {
|
|
1872
1892
|
const r = document.createElement("source");
|
|
@@ -1876,10 +1896,10 @@ class $o {
|
|
|
1876
1896
|
return this.enabled;
|
|
1877
1897
|
}
|
|
1878
1898
|
attach(e) {
|
|
1879
|
-
if (!
|
|
1899
|
+
if (!Ot()) {
|
|
1880
1900
|
if (!this.wakeLockVideo) {
|
|
1881
1901
|
const t = document.createElement("video");
|
|
1882
|
-
this.wakeLockVideo = t, this.wakeLockVideo.setAttribute("title", "Live Stream"), this.wakeLockVideo.setAttribute("playsinline", ""), this._addSourceToVideo(this.wakeLockVideo, "mp4",
|
|
1902
|
+
this.wakeLockVideo = t, this.wakeLockVideo.setAttribute("title", "Live Stream"), this.wakeLockVideo.setAttribute("playsinline", ""), this._addSourceToVideo(this.wakeLockVideo, "mp4", ta), Object.assign(this.wakeLockVideo.style, {
|
|
1883
1903
|
position: "absolute",
|
|
1884
1904
|
left: "-100%",
|
|
1885
1905
|
top: "-100%"
|
|
@@ -1895,7 +1915,7 @@ class $o {
|
|
|
1895
1915
|
enable() {
|
|
1896
1916
|
return y(this, null, function* () {
|
|
1897
1917
|
var e, t;
|
|
1898
|
-
return
|
|
1918
|
+
return Ot() ? navigator.wakeLock.request("screen").then((s) => {
|
|
1899
1919
|
this._wakeLock = s, this.enabled = !0, this._wakeLock.addEventListener("release", () => {
|
|
1900
1920
|
});
|
|
1901
1921
|
}).catch(() => {
|
|
@@ -1907,19 +1927,19 @@ class $o {
|
|
|
1907
1927
|
}
|
|
1908
1928
|
disable() {
|
|
1909
1929
|
var e, t;
|
|
1910
|
-
|
|
1930
|
+
Ot() ? (this._wakeLock && this._wakeLock.release(), this._wakeLock = null) : ((e = this.wakeLockVideo) == null || e.pause(), (t = this.wakeLockVideo) == null || t.remove()), this.enabled = !1;
|
|
1911
1931
|
}
|
|
1912
1932
|
unload() {
|
|
1913
1933
|
document.removeEventListener("visibilitychange", this.handleVisibilityChange), document.removeEventListener("fullscreenchange", this.handleVisibilityChange), this.disable();
|
|
1914
1934
|
}
|
|
1915
1935
|
}
|
|
1916
|
-
const
|
|
1936
|
+
const sa = /\r\n|\r|\n/;
|
|
1917
1937
|
var Ce, pe;
|
|
1918
|
-
class
|
|
1938
|
+
class Ts {
|
|
1919
1939
|
constructor(e) {
|
|
1920
1940
|
w(this, Ce);
|
|
1921
1941
|
w(this, pe);
|
|
1922
|
-
|
|
1942
|
+
S(this, Ce, e), S(this, pe, 0);
|
|
1923
1943
|
}
|
|
1924
1944
|
skipEmptyLines() {
|
|
1925
1945
|
let e = 0;
|
|
@@ -1945,27 +1965,27 @@ class ys {
|
|
|
1945
1965
|
}
|
|
1946
1966
|
}
|
|
1947
1967
|
Ce = new WeakMap(), pe = new WeakMap();
|
|
1948
|
-
var We,
|
|
1949
|
-
class
|
|
1968
|
+
var We, rn, Li;
|
|
1969
|
+
class na {
|
|
1950
1970
|
constructor() {
|
|
1951
1971
|
w(this, We);
|
|
1952
1972
|
}
|
|
1953
1973
|
parse(e) {
|
|
1954
|
-
const t = [], s = e.split(
|
|
1974
|
+
const t = [], s = e.split(sa), r = new Ts(s), o = r.readLine();
|
|
1955
1975
|
if (!o || !o.startsWith("WEBVTT"))
|
|
1956
1976
|
throw new Error("missing 'WEBVTT' signature");
|
|
1957
1977
|
for (; r.readLine() !== ""; )
|
|
1958
1978
|
;
|
|
1959
1979
|
for (; r.linesLeft() > 0; ) {
|
|
1960
|
-
const a =
|
|
1980
|
+
const a = F(this, We, rn).call(this, r);
|
|
1961
1981
|
t.push(a), r.skipEmptyLines();
|
|
1962
1982
|
}
|
|
1963
1983
|
return t;
|
|
1964
1984
|
}
|
|
1965
1985
|
}
|
|
1966
|
-
We = new WeakSet(),
|
|
1986
|
+
We = new WeakSet(), rn = function(e) {
|
|
1967
1987
|
e.skipEmptyLines();
|
|
1968
|
-
const t = e.takeUntilEmptyLine(), s = new
|
|
1988
|
+
const t = e.takeUntilEmptyLine(), s = new Ts(t);
|
|
1969
1989
|
let r = s.readLine(), o;
|
|
1970
1990
|
if (r != null && r.includes("-->") || (o = r, r = s.readLine()), r === void 0)
|
|
1971
1991
|
throw new Error("expected cue line");
|
|
@@ -1978,14 +1998,14 @@ We = new WeakSet(), sn = function(e) {
|
|
|
1978
1998
|
const l = s.readLine();
|
|
1979
1999
|
if (!l)
|
|
1980
2000
|
throw new Error("missing text");
|
|
1981
|
-
const m =
|
|
2001
|
+
const m = F(this, We, Li).call(this, a), g = F(this, We, Li).call(this, h);
|
|
1982
2002
|
return {
|
|
1983
2003
|
id: o,
|
|
1984
2004
|
startTime: m,
|
|
1985
2005
|
endTime: g,
|
|
1986
2006
|
text: l
|
|
1987
2007
|
};
|
|
1988
|
-
},
|
|
2008
|
+
}, Li = function(e) {
|
|
1989
2009
|
const t = e.split(":");
|
|
1990
2010
|
if (t.length == 2) {
|
|
1991
2011
|
const [c = 0, h = 0] = t.map((l) => parseFloat(l));
|
|
@@ -1999,11 +2019,11 @@ class Mi extends Pe {
|
|
|
1999
2019
|
super();
|
|
2000
2020
|
n(this, "element");
|
|
2001
2021
|
n(this, "logger");
|
|
2002
|
-
n(this, "seekTimes", new
|
|
2022
|
+
n(this, "seekTimes", new J(10));
|
|
2003
2023
|
n(this, "seekStartTime");
|
|
2004
2024
|
// represents the user specified "muted" state
|
|
2005
2025
|
n(this, "_userProvidedMuted");
|
|
2006
|
-
n(this, "timers", new
|
|
2026
|
+
n(this, "timers", new q());
|
|
2007
2027
|
n(this, "_userHasProvidedInput", !1);
|
|
2008
2028
|
n(this, "_isPaused", !0);
|
|
2009
2029
|
n(this, "isActivated", !1);
|
|
@@ -2114,7 +2134,7 @@ class Mi extends Pe {
|
|
|
2114
2134
|
}, 0), this.element.addEventListener("stalled", this.onEvent), this.element.addEventListener("canplay", this.onEvent), this.element.addEventListener("loadeddata", this.onEvent), this.element.addEventListener("loadedmetadata", this.onEvent), this.element.addEventListener("canplaythrough", this.onEvent), this.element.addEventListener("waiting", this.onEvent), this.element.addEventListener("playing", this.onPlayPause), this.element.addEventListener("pause", this.onPlayPause), this.element.addEventListener("seeked", this.onSeekEnd), this.element.addEventListener("seeking", this.onSeekStart), this.element.addEventListener("volumechange", this.onVolumeChange), this.element.addEventListener("timeupdate", this.onBufferStateChange), this.element.addEventListener("progress", this.onBufferStateChange);
|
|
2115
2135
|
}
|
|
2116
2136
|
get seekTime() {
|
|
2117
|
-
return this.seekTimes.isEmpty() ? 0 :
|
|
2137
|
+
return this.seekTimes.isEmpty() ? 0 : Ut(this.seekTimes.items());
|
|
2118
2138
|
}
|
|
2119
2139
|
get isSeeking() {
|
|
2120
2140
|
return this.element.seeking;
|
|
@@ -2150,7 +2170,7 @@ class Mi extends Pe {
|
|
|
2150
2170
|
return this._isPaused;
|
|
2151
2171
|
}
|
|
2152
2172
|
}
|
|
2153
|
-
const
|
|
2173
|
+
const ra = [
|
|
2154
2174
|
"minBufferTime",
|
|
2155
2175
|
"maxBufferTime",
|
|
2156
2176
|
"burstEnabled",
|
|
@@ -2158,10 +2178,10 @@ const ia = [
|
|
|
2158
2178
|
"separateVideoSocketEnabled",
|
|
2159
2179
|
"videoCodecs"
|
|
2160
2180
|
];
|
|
2161
|
-
function
|
|
2162
|
-
return
|
|
2181
|
+
function oa(i) {
|
|
2182
|
+
return ra.includes(i);
|
|
2163
2183
|
}
|
|
2164
|
-
class
|
|
2184
|
+
class aa {
|
|
2165
2185
|
constructor(e) {
|
|
2166
2186
|
n(this, "options");
|
|
2167
2187
|
n(this, "overrides", /* @__PURE__ */ new Map());
|
|
@@ -2199,7 +2219,7 @@ class na {
|
|
|
2199
2219
|
*/
|
|
2200
2220
|
get(e, t) {
|
|
2201
2221
|
var s;
|
|
2202
|
-
if (t &&
|
|
2222
|
+
if (t && oa(e)) {
|
|
2203
2223
|
const r = (s = this.overrides.get(t)) == null ? void 0 : s[e];
|
|
2204
2224
|
if (typeof r != "undefined")
|
|
2205
2225
|
return r;
|
|
@@ -2217,10 +2237,10 @@ class na {
|
|
|
2217
2237
|
return (s = this.overrides.get(t)) == null ? void 0 : s[e];
|
|
2218
2238
|
}
|
|
2219
2239
|
}
|
|
2220
|
-
const
|
|
2240
|
+
const ca = (i) => {
|
|
2221
2241
|
const e = window;
|
|
2222
2242
|
e.vindralInstances = e.vindralInstances || {}, e.vindralInstances[i.getStatistics().clientId.substring(0, 8)] = i;
|
|
2223
|
-
},
|
|
2243
|
+
}, da = (i) => {
|
|
2224
2244
|
if (!navigator.mediaCapabilities)
|
|
2225
2245
|
return Promise.resolve({ smooth: !0, supported: !0, powerEfficient: !0, failedToQuery: !0 });
|
|
2226
2246
|
if (i.codec === "webvtt")
|
|
@@ -2244,7 +2264,7 @@ const ra = (i) => {
|
|
|
2244
2264
|
framerate: i.frameRate[0] / i.frameRate[1]
|
|
2245
2265
|
}
|
|
2246
2266
|
}, navigator.mediaCapabilities.decodingInfo(e);
|
|
2247
|
-
},
|
|
2267
|
+
}, ha = 0.15, ua = 0.2, Cs = 0.4, la = 0.5, ma = 0.6, Ii = 15, fa = {
|
|
2248
2268
|
cooldownTime: 3e3,
|
|
2249
2269
|
maxBufferingEvents: {
|
|
2250
2270
|
last10Seconds: 0
|
|
@@ -2259,7 +2279,7 @@ const ra = (i) => {
|
|
|
2259
2279
|
ratio: 0.1
|
|
2260
2280
|
},
|
|
2261
2281
|
maxCooldownRatio: 2
|
|
2262
|
-
},
|
|
2282
|
+
}, Bi = (i) => (e) => e > i, Jt = class Jt {
|
|
2263
2283
|
constructor(e, t, s, r) {
|
|
2264
2284
|
n(this, "qualityOfServiceSource");
|
|
2265
2285
|
n(this, "config");
|
|
@@ -2287,7 +2307,7 @@ const ra = (i) => {
|
|
|
2287
2307
|
isAbrEnabled: this.isEnabled
|
|
2288
2308
|
}));
|
|
2289
2309
|
n(this, "isQoSOk", (e) => {
|
|
2290
|
-
const t = this.qualityOfServiceSource.getLevelStats(e), { upgradesFromLevel: s, downgradesFromLevel: r } = t != null ? t : { upgradesFromLevel: [], downgradesFromLevel: [] }, o = Date.now() - this.config.maxDowngradeLookbackMs, a = r.filter(
|
|
2310
|
+
const t = this.qualityOfServiceSource.getLevelStats(e), { upgradesFromLevel: s, downgradesFromLevel: r } = t != null ? t : { upgradesFromLevel: [], downgradesFromLevel: [] }, o = Date.now() - this.config.maxDowngradeLookbackMs, a = r.filter(Bi(o)).length, c = s.filter(Bi(o)).length;
|
|
2291
2311
|
if (a - c > this.config.maxRecentDowngradesCount)
|
|
2292
2312
|
return this.logger.debug("Recent downgrades count is over maximum", {
|
|
2293
2313
|
downgrades: a - c,
|
|
@@ -2304,7 +2324,7 @@ const ra = (i) => {
|
|
|
2304
2324
|
recentDowngrades: a,
|
|
2305
2325
|
timeSpentPlayingInAtLeastLevelRatio: h
|
|
2306
2326
|
}), !1;
|
|
2307
|
-
const m = Math.max(0, r.length - s.length - l), g = Date.now() - this.config.maxDowngradeLookbackMs * m, p = r.filter(
|
|
2327
|
+
const m = Math.max(0, r.length - s.length - l), g = Date.now() - this.config.maxDowngradeLookbackMs * m, p = r.filter(Bi(g)).length;
|
|
2308
2328
|
return p && m > this.config.maxCooldownRatio ? (this.logger.debug("Too many downgrades compared to time spent playing", {
|
|
2309
2329
|
downgradesWithinCooldownTime: p,
|
|
2310
2330
|
cooldownRatio: m
|
|
@@ -2316,7 +2336,7 @@ const ra = (i) => {
|
|
|
2316
2336
|
const { bufferFullness: t, general: s } = this.qualityOfServiceSource.getMetrics(), r = this.qualityOfServiceSource.getBufferFullnessRegression();
|
|
2317
2337
|
if (!r)
|
|
2318
2338
|
return;
|
|
2319
|
-
const o = 10 * 1e3, { slope: a } = r, c = r.predict(
|
|
2339
|
+
const o = 10 * 1e3, { slope: a } = r, c = r.predict(Ii), h = a < 0, u = r.predict(Ii) < Cs && r.slope < 0, l = r.predict(Ii) > ma, m = this.qualityOfServiceSource.timeSpentBufferingLast(30 * 1e3), g = this.qualityOfServiceSource.timeSpentActiveLast(30 * 1e3), p = m / g;
|
|
2320
2340
|
if (t < 0.15 && p > 0.8) {
|
|
2321
2341
|
this.adaptLevel("reconnect");
|
|
2322
2342
|
return;
|
|
@@ -2325,13 +2345,13 @@ const ra = (i) => {
|
|
|
2325
2345
|
this.adaptLevel("downgrade");
|
|
2326
2346
|
return;
|
|
2327
2347
|
}
|
|
2328
|
-
u || t <
|
|
2348
|
+
u || t < ha ? h && t < Cs && c < ua && this.adaptLevel(e.playbackState === "buffering" ? "double downgrade" : "downgrade") : t > la && l && !this.tooMuchTimeBuffering(o) && !this.tooManyBufferingEvents(o) && this.adaptLevel("upgrade");
|
|
2329
2349
|
});
|
|
2330
2350
|
n(this, "onAdaptedLevel", () => {
|
|
2331
2351
|
this.reset();
|
|
2332
2352
|
});
|
|
2333
2353
|
n(this, "adaptLevel", (e) => this.emitter.emit("adapt level", e));
|
|
2334
|
-
this.qualityOfServiceSource = s, this.config =
|
|
2354
|
+
this.qualityOfServiceSource = s, this.config = A(A({}, fa), r), this.emitter = e, this.logger = t;
|
|
2335
2355
|
}
|
|
2336
2356
|
tooMuchTimeBuffering(e) {
|
|
2337
2357
|
return this.qualityOfServiceSource.timeSpentBufferingLast(e) / this.qualityOfServiceSource.timeSpentActiveLast(e) > this.config.maxBufferingRatio.last10Seconds;
|
|
@@ -2340,9 +2360,9 @@ const ra = (i) => {
|
|
|
2340
2360
|
return this.qualityOfServiceSource.timeSpentBufferingLast(e) > this.config.maxBufferingEvents.last10Seconds;
|
|
2341
2361
|
}
|
|
2342
2362
|
};
|
|
2343
|
-
n(
|
|
2344
|
-
let
|
|
2345
|
-
const
|
|
2363
|
+
n(Jt, "create", (e, t, s, r = {}) => new Jt(e, t, s, r));
|
|
2364
|
+
let _i = Jt;
|
|
2365
|
+
const Aa = {
|
|
2346
2366
|
minBufferTime: 1500,
|
|
2347
2367
|
maxBufferTime: 1500,
|
|
2348
2368
|
cooldownTime: 3e4,
|
|
@@ -2352,7 +2372,7 @@ const la = {
|
|
|
2352
2372
|
maxBufferingRatio: {
|
|
2353
2373
|
last30Seconds: 0.15
|
|
2354
2374
|
}
|
|
2355
|
-
},
|
|
2375
|
+
}, ve = class ve {
|
|
2356
2376
|
constructor(e, t, s, r, o) {
|
|
2357
2377
|
n(this, "qualityOfServiceSource");
|
|
2358
2378
|
n(this, "targetBufferTimeTarget");
|
|
@@ -2386,8 +2406,8 @@ const la = {
|
|
|
2386
2406
|
return;
|
|
2387
2407
|
const o = this.qualityOfServiceSource.timeSpentBufferingLast(30 * 1e3), a = this.qualityOfServiceSource.bufferingEventsLast(30 * 1e3), c = this.qualityOfServiceSource.timeSpentActiveLast(30 * 1e3), h = o / c, u = Math.ceil(
|
|
2388
2408
|
Math.max(
|
|
2389
|
-
(s - t) / (
|
|
2390
|
-
|
|
2409
|
+
(s - t) / (ve.BUFFER_TIME_MAX_STEPS - 1),
|
|
2410
|
+
ve.BUFFER_TIME_STEP_SIZE
|
|
2391
2411
|
)
|
|
2392
2412
|
);
|
|
2393
2413
|
(h > this.config.maxBufferingRatio.last30Seconds || a > this.config.maxBufferingEvents.last30Seconds) && (this.targetBufferTimeTarget.targetBufferTime = Math.min(
|
|
@@ -2395,19 +2415,19 @@ const la = {
|
|
|
2395
2415
|
this.targetBufferTimeTarget.targetBufferTime + u
|
|
2396
2416
|
), this.bufferTimeAdjustmentCount++, this.reset());
|
|
2397
2417
|
});
|
|
2398
|
-
this.qualityOfServiceSource = s, this.targetBufferTimeTarget = r, this.config =
|
|
2418
|
+
this.qualityOfServiceSource = s, this.targetBufferTimeTarget = r, this.config = A(A({}, Aa), o), this.emitter = e, this.logger = t;
|
|
2399
2419
|
}
|
|
2400
2420
|
updateConfig(e) {
|
|
2401
|
-
this.config =
|
|
2421
|
+
this.config = A(A({}, this.config), e);
|
|
2402
2422
|
}
|
|
2403
2423
|
};
|
|
2404
|
-
n(
|
|
2405
|
-
let
|
|
2406
|
-
const
|
|
2424
|
+
n(ve, "BUFFER_TIME_STEP_SIZE", 500), n(ve, "BUFFER_TIME_MAX_STEPS", 3), n(ve, "create", (e, t, s, r, o = {}) => new ve(e, t, s, r, o));
|
|
2425
|
+
let Di = ve;
|
|
2426
|
+
const ga = (i, e) => {
|
|
2407
2427
|
const t = new URL("/subscribe", i);
|
|
2408
2428
|
return t.searchParams.append("channelId", e.channelId), t.searchParams.append("sessionId", e.sessionId), t.searchParams.append("clientId", e.clientId), e.audio && e.audio.codec && (t.searchParams.append("audio.bitRate", Math.round(e.audio.bitRate).toString()), t.searchParams.append("audio.codec", e.audio.codec), e.audio.language && t.searchParams.append("audio.language", e.audio.language)), e.video && e.video.codec && (t.searchParams.append("video.width", e.video.width.toString()), t.searchParams.append("video.height", e.video.height.toString()), t.searchParams.append("video.bitRate", Math.round(e.video.bitRate).toString()), t.searchParams.append("video.codec", e.video.codec)), e.expectAdditionalConnection && t.searchParams.append("expectAdditionalConnection", e.expectAdditionalConnection.toString()), e.burstMs && t.searchParams.append("burstMs", e.burstMs.toString()), e.channelGroupId && t.searchParams.append("channelGroupId", e.channelGroupId), e.authToken && (t.searchParams.append("auth.token", e.authToken), t.searchParams.append("auth.type", "jwt")), t.toString();
|
|
2409
2429
|
};
|
|
2410
|
-
class
|
|
2430
|
+
class pa extends Pe {
|
|
2411
2431
|
constructor(t, s) {
|
|
2412
2432
|
super();
|
|
2413
2433
|
n(this, "options");
|
|
@@ -2460,34 +2480,34 @@ class Aa extends Pe {
|
|
|
2460
2480
|
this.websockets.length !== 0 && this.options.onMessage(t, s.data);
|
|
2461
2481
|
});
|
|
2462
2482
|
n(this, "onError", () => {
|
|
2463
|
-
this.logger.info("On error",
|
|
2483
|
+
this.logger.info("On error", A({}, this.options)), this.close("one websocket had an error"), this.emit("error", new T("WebSocket error", { code: "websocket_error", isFatal: !1 }));
|
|
2464
2484
|
});
|
|
2465
2485
|
n(this, "onClose", (t) => {
|
|
2466
|
-
switch (this.logger.info("Closed",
|
|
2486
|
+
switch (this.logger.info("Closed", L(A({}, this.options), {
|
|
2467
2487
|
reason: t.reason,
|
|
2468
2488
|
code: t.code,
|
|
2469
2489
|
isSuspended: this.isSuspended
|
|
2470
2490
|
})), this.close("one websocket was closed"), t.code) {
|
|
2471
2491
|
case 4e3:
|
|
2472
|
-
this.emit("error",
|
|
2492
|
+
this.emit("error", zt(ft()));
|
|
2473
2493
|
break;
|
|
2474
2494
|
case 4001:
|
|
2475
|
-
this.emit("error",
|
|
2495
|
+
this.emit("error", zt(ft()));
|
|
2476
2496
|
break;
|
|
2477
2497
|
case 4002:
|
|
2478
|
-
this.emit("error",
|
|
2498
|
+
this.emit("error", mr(ft()));
|
|
2479
2499
|
break;
|
|
2480
2500
|
case 4003:
|
|
2481
|
-
this.emit("error",
|
|
2501
|
+
this.emit("error", Qs("internal", ft()));
|
|
2482
2502
|
break;
|
|
2483
2503
|
case 4010:
|
|
2484
|
-
this.emit("error",
|
|
2504
|
+
this.emit("error", fr("internal", ft()));
|
|
2485
2505
|
break;
|
|
2486
2506
|
}
|
|
2487
2507
|
this.emit("close", this);
|
|
2488
2508
|
});
|
|
2489
2509
|
n(this, "onOpen", () => {
|
|
2490
|
-
this.logger.info("Opened",
|
|
2510
|
+
this.logger.info("Opened", A({}, this.options)), this.readyState() === WebSocket.OPEN && (this._connectTime = Date.now() - this.connectStartTime, this.reconnectState.reconnectRetries = 0, this._isConnectInProgress = !1, this.emit("open", this));
|
|
2491
2511
|
});
|
|
2492
2512
|
/**
|
|
2493
2513
|
* @returns a promise that resolves true if the connect steps succeeded
|
|
@@ -2499,10 +2519,10 @@ class Aa extends Pe {
|
|
|
2499
2519
|
if (this.isSuspended)
|
|
2500
2520
|
return !1;
|
|
2501
2521
|
if (this.readyState() !== WebSocket.CLOSED && this.close("new connection in progress"), this.shouldContinueConnecting = !0, this._isConnectInProgress = !0, t && this.options.reconnectDelay > 0) {
|
|
2502
|
-
this.logger.info("Waiting for reconnect delay",
|
|
2522
|
+
this.logger.info("Waiting for reconnect delay", A({}, this.options)), yield xi(this.options.reconnectDelay);
|
|
2503
2523
|
const s = yield this.options.reconnectHandler(this.reconnectState);
|
|
2504
2524
|
if (this.reconnectState.reconnectRetries++, !s)
|
|
2505
|
-
return this._isConnectInProgress = !1, this.emit("error",
|
|
2525
|
+
return this._isConnectInProgress = !1, this.emit("error", Xs()), !1;
|
|
2506
2526
|
}
|
|
2507
2527
|
this._connectionAttemptCount++;
|
|
2508
2528
|
try {
|
|
@@ -2511,7 +2531,7 @@ class Aa extends Pe {
|
|
|
2511
2531
|
const { url: s, connectionCount: r } = yield this.options.connectHandler();
|
|
2512
2532
|
if (this.connectStartTime = Date.now(), !this.shouldContinueConnecting)
|
|
2513
2533
|
return this._isConnectInProgress = !1, this.logger.info("Connection aborted"), !1;
|
|
2514
|
-
this.logger.info("Connecting websockets",
|
|
2534
|
+
this.logger.info("Connecting websockets", L(A({}, this.options), { url: s }));
|
|
2515
2535
|
for (let o = 0; o < r; o++) {
|
|
2516
2536
|
const a = new WebSocket(s);
|
|
2517
2537
|
a.binaryType = "arraybuffer", a.onmessage = (c) => this.onMessage(o, c), a.addEventListener("error", this.onError), a.addEventListener("close", this.onClose), a.addEventListener("open", this.onOpen), this.websockets.push(a);
|
|
@@ -2544,13 +2564,13 @@ class Aa extends Pe {
|
|
|
2544
2564
|
return this._connectTime;
|
|
2545
2565
|
}
|
|
2546
2566
|
}
|
|
2547
|
-
const
|
|
2567
|
+
const wa = 65536 * 8, Sa = 0.9, Ri = (i) => wa * Sa * 1e3 / i, ce = class ce {
|
|
2548
2568
|
constructor(e, t, s) {
|
|
2549
2569
|
n(this, "emitter");
|
|
2550
2570
|
n(this, "transport");
|
|
2551
2571
|
n(this, "logger");
|
|
2552
2572
|
n(this, "config");
|
|
2553
|
-
n(this, "rtts", new
|
|
2573
|
+
n(this, "rtts", new J(10));
|
|
2554
2574
|
n(this, "lastPingSentTime", Date.now());
|
|
2555
2575
|
n(this, "isPingInFlight", !1);
|
|
2556
2576
|
n(this, "connectCount", 0);
|
|
@@ -2561,7 +2581,7 @@ const fa = 65536 * 8, ga = 0.9, Ii = (i) => fa * ga * 1e3 / i, ce = class ce {
|
|
|
2561
2581
|
n(this, "contextSwitchesInProgress", /* @__PURE__ */ new Set());
|
|
2562
2582
|
n(this, "contextSwitchesCompleted", /* @__PURE__ */ new Set());
|
|
2563
2583
|
n(this, "buffer", []);
|
|
2564
|
-
n(this, "disconnected", new
|
|
2584
|
+
n(this, "disconnected", new St());
|
|
2565
2585
|
n(this, "unload", () => {
|
|
2566
2586
|
this.logger.debug("Unloading module..."), this.close("Unloading"), this.emitter.off("send signal", this.sendSignal), this.emitter.off("disconnect", this.close), this.emitter.off("reconnect", this.reconnect), this.logger.debug("Unloaded module");
|
|
2567
2587
|
});
|
|
@@ -2593,7 +2613,7 @@ const fa = 65536 * 8, ga = 0.9, Ii = (i) => fa * ga * 1e3 / i, ce = class ce {
|
|
|
2593
2613
|
const e = Ye(this.rtts.items());
|
|
2594
2614
|
return {
|
|
2595
2615
|
rtt: e,
|
|
2596
|
-
estimatedBandwidth:
|
|
2616
|
+
estimatedBandwidth: Ri(e.average),
|
|
2597
2617
|
edgeUrl: (t = this.transport) == null ? void 0 : t.url(),
|
|
2598
2618
|
connectionProtocol: "vindral_ws"
|
|
2599
2619
|
};
|
|
@@ -2608,7 +2628,7 @@ const fa = 65536 * 8, ga = 0.9, Ii = (i) => fa * ga * 1e3 / i, ce = class ce {
|
|
|
2608
2628
|
if (this.contextSwitchesInProgress.has(e)) {
|
|
2609
2629
|
if (!(t instanceof ArrayBuffer)) {
|
|
2610
2630
|
const r = JSON.parse(t);
|
|
2611
|
-
if (
|
|
2631
|
+
if (us(r) && r.type === "context switch complete") {
|
|
2612
2632
|
this.logger.info("context switch completed", { socketId: e }), this.emitter.emit("context switch complete"), this.contextSwitchesCompleted.add(e);
|
|
2613
2633
|
return;
|
|
2614
2634
|
}
|
|
@@ -2619,10 +2639,13 @@ const fa = 65536 * 8, ga = 0.9, Ii = (i) => fa * ga * 1e3 / i, ce = class ce {
|
|
|
2619
2639
|
this.handleMessage(e, t);
|
|
2620
2640
|
});
|
|
2621
2641
|
n(this, "resolveEdgeUrl", () => y(this, null, function* () {
|
|
2622
|
-
const e = this.config.connectInfo, t = yield this.config.onConnectInfo(e),
|
|
2642
|
+
const e = this.config.connectInfo, t = yield this.config.onConnectInfo(e), s = this.config.options.getOverride(
|
|
2623
2643
|
"separateVideoSocketEnabled",
|
|
2624
2644
|
t.channelId
|
|
2625
|
-
)
|
|
2645
|
+
), r = this.config.options.get("media") === "audio+video";
|
|
2646
|
+
let o = 1;
|
|
2647
|
+
r && (o = s !== !1 ? 2 : 1);
|
|
2648
|
+
const a = ga(this.config.edgeUrl, {
|
|
2626
2649
|
video: t.video,
|
|
2627
2650
|
audio: t.audio,
|
|
2628
2651
|
burstMs: t.burstMs,
|
|
@@ -2630,17 +2653,17 @@ const fa = 65536 * 8, ga = 0.9, Ii = (i) => fa * ga * 1e3 / i, ce = class ce {
|
|
|
2630
2653
|
clientId: t.clientId,
|
|
2631
2654
|
channelId: t.channelId,
|
|
2632
2655
|
channelGroupId: t.channelGroupId,
|
|
2633
|
-
expectAdditionalConnection:
|
|
2656
|
+
expectAdditionalConnection: o > 1,
|
|
2634
2657
|
authToken: this.config.options.get("authenticationToken")
|
|
2635
2658
|
});
|
|
2636
|
-
return this.logger.debug("Resolved edge url", { edgeUrl:
|
|
2659
|
+
return this.logger.debug("Resolved edge url", { edgeUrl: a }), { url: a, connectionCount: o };
|
|
2637
2660
|
}));
|
|
2638
2661
|
n(this, "handleMessage", (e, t) => {
|
|
2639
2662
|
if (t instanceof ArrayBuffer)
|
|
2640
2663
|
this.emitter.emit("received data", t);
|
|
2641
2664
|
else {
|
|
2642
2665
|
const s = JSON.parse(t);
|
|
2643
|
-
if (!
|
|
2666
|
+
if (!us(s))
|
|
2644
2667
|
return;
|
|
2645
2668
|
switch (s.type) {
|
|
2646
2669
|
case "pong":
|
|
@@ -2656,7 +2679,7 @@ const fa = 65536 * 8, ga = 0.9, Ii = (i) => fa * ga * 1e3 / i, ce = class ce {
|
|
|
2656
2679
|
}
|
|
2657
2680
|
});
|
|
2658
2681
|
n(this, "connectWebSocketTransport", () => {
|
|
2659
|
-
const e = new
|
|
2682
|
+
const e = new pa(
|
|
2660
2683
|
{
|
|
2661
2684
|
reconnectDelay: 1e3,
|
|
2662
2685
|
onMessage: this.onMessage,
|
|
@@ -2705,13 +2728,13 @@ const fa = 65536 * 8, ga = 0.9, Ii = (i) => fa * ga * 1e3 / i, ce = class ce {
|
|
|
2705
2728
|
type: "ping"
|
|
2706
2729
|
});
|
|
2707
2730
|
});
|
|
2708
|
-
this._estimatedPingBandwidth =
|
|
2731
|
+
this._estimatedPingBandwidth = Ri(s.estimatedRtt), this.logger = t, this.emitter = e, this.config = s, this.emitter.on("send signal", this.sendSignal), this.emitter.on("disconnect", this.close), this.emitter.on("reconnect", this.reconnect), this.disconnected.promise.catch(le), this.transport = this.connectWebSocketTransport();
|
|
2709
2732
|
}
|
|
2710
2733
|
get rtt() {
|
|
2711
|
-
return this.rtts.items().length > 0 ?
|
|
2734
|
+
return this.rtts.items().length > 0 ? Ut(this.rtts.items()) : 0;
|
|
2712
2735
|
}
|
|
2713
2736
|
get estimatedBandwidth() {
|
|
2714
|
-
return this.rtt > 0 ?
|
|
2737
|
+
return this.rtt > 0 ? Ri(this.rtt) : this._estimatedPingBandwidth;
|
|
2715
2738
|
}
|
|
2716
2739
|
/**
|
|
2717
2740
|
* The timestamp when the first connection was made
|
|
@@ -2733,14 +2756,14 @@ n(ce, "PING_INTERVAL", 5e3), n(ce, "MAX_MISSED_PINGS", 4), n(ce, "TLS_ROUNDTRIPS
|
|
|
2733
2756
|
const a = new ce(e, t, s);
|
|
2734
2757
|
a.transport.once("error", (c) => o(c)), a.transport.once("open", () => r(a));
|
|
2735
2758
|
}));
|
|
2736
|
-
let
|
|
2759
|
+
let Oi = ce;
|
|
2737
2760
|
var at, Ie, ct;
|
|
2738
|
-
class
|
|
2761
|
+
class va {
|
|
2739
2762
|
constructor(e) {
|
|
2740
2763
|
w(this, at);
|
|
2741
2764
|
w(this, Ie, []);
|
|
2742
2765
|
w(this, ct);
|
|
2743
|
-
|
|
2766
|
+
S(this, at, e);
|
|
2744
2767
|
}
|
|
2745
2768
|
/**
|
|
2746
2769
|
* Select an edge url based on the provided list of edge urls, previous cached edges or the edgeUrl option
|
|
@@ -2755,9 +2778,9 @@ class pa {
|
|
|
2755
2778
|
select(e) {
|
|
2756
2779
|
if (d(this, at).edgeUrl)
|
|
2757
2780
|
return d(this, at).edgeUrl;
|
|
2758
|
-
d(this, Ie).length === 0 &&
|
|
2781
|
+
d(this, Ie).length === 0 && S(this, Ie, d(this, Ie).concat(e));
|
|
2759
2782
|
const t = d(this, Ie).shift();
|
|
2760
|
-
if (
|
|
2783
|
+
if (S(this, ct, t), t)
|
|
2761
2784
|
return t;
|
|
2762
2785
|
}
|
|
2763
2786
|
/**
|
|
@@ -2771,14 +2794,14 @@ class pa {
|
|
|
2771
2794
|
* Resets the cached list of edges
|
|
2772
2795
|
*/
|
|
2773
2796
|
reset() {
|
|
2774
|
-
|
|
2797
|
+
S(this, ct, void 0), S(this, Ie, []);
|
|
2775
2798
|
}
|
|
2776
2799
|
}
|
|
2777
2800
|
at = new WeakMap(), Ie = new WeakMap(), ct = new WeakMap();
|
|
2778
|
-
var he, dt, we, ht,
|
|
2801
|
+
var he, dt, we, ht, Yt, Kt, $t, on;
|
|
2779
2802
|
const tt = class tt {
|
|
2780
2803
|
constructor(e, t, s) {
|
|
2781
|
-
w(this,
|
|
2804
|
+
w(this, $t);
|
|
2782
2805
|
n(this, "emitter");
|
|
2783
2806
|
n(this, "logger");
|
|
2784
2807
|
n(this, "config");
|
|
@@ -2794,14 +2817,14 @@ const tt = class tt {
|
|
|
2794
2817
|
});
|
|
2795
2818
|
n(this, "suspend", () => {
|
|
2796
2819
|
var e;
|
|
2797
|
-
|
|
2820
|
+
S(this, he, !1), (e = this.connectionImpl) == null || e.suspend();
|
|
2798
2821
|
});
|
|
2799
2822
|
n(this, "unsuspend", () => {
|
|
2800
2823
|
var e;
|
|
2801
|
-
|
|
2824
|
+
S(this, he, !0), (e = this.connectionImpl) == null || e.unsuspend(), this.connect();
|
|
2802
2825
|
});
|
|
2803
2826
|
n(this, "getState", () => this.connectionImpl ? this.connectionImpl.getState() : "disconnected");
|
|
2804
|
-
n(this, "getStatistics", () => this.connectionImpl ?
|
|
2827
|
+
n(this, "getStatistics", () => this.connectionImpl ? L(A({}, this.connectionImpl.getStatistics()), {
|
|
2805
2828
|
connectCount: d(this, ht),
|
|
2806
2829
|
connectionAttemptCount: d(this, we)
|
|
2807
2830
|
}) : {
|
|
@@ -2812,39 +2835,39 @@ const tt = class tt {
|
|
|
2812
2835
|
connectionProtocol: void 0
|
|
2813
2836
|
});
|
|
2814
2837
|
n(this, "connect", () => {
|
|
2815
|
-
|
|
2838
|
+
S(this, he, !0), !d(this, dt) && S(this, dt, F(this, $t, on).call(this));
|
|
2816
2839
|
});
|
|
2817
2840
|
n(this, "disconnect", (e = "Disconnect Requested") => {
|
|
2818
2841
|
var t;
|
|
2819
|
-
|
|
2842
|
+
S(this, he, !1), (t = this.connectionImpl) == null || t.close(e);
|
|
2820
2843
|
});
|
|
2821
2844
|
n(this, "reconnect", (e) => {
|
|
2822
2845
|
this.disconnect(e), this.connect();
|
|
2823
2846
|
});
|
|
2824
|
-
w(this,
|
|
2847
|
+
w(this, Yt, () => y(this, null, function* () {
|
|
2825
2848
|
try {
|
|
2826
2849
|
return yield this.apiClient.connect(this.config.options.getOptions());
|
|
2827
2850
|
} catch (e) {
|
|
2828
|
-
if (
|
|
2851
|
+
if (Tn(e))
|
|
2829
2852
|
switch (e.status) {
|
|
2830
2853
|
case 401:
|
|
2831
|
-
throw this.emitter.emit("error",
|
|
2854
|
+
throw this.emitter.emit("error", zt(e)), zt(e);
|
|
2832
2855
|
case 403:
|
|
2833
|
-
throw this.emitter.emit("error",
|
|
2856
|
+
throw this.emitter.emit("error", fs(e.message)), fs(e.message);
|
|
2834
2857
|
}
|
|
2835
|
-
throw this.emitter.emit("error",
|
|
2858
|
+
throw this.emitter.emit("error", gr(e instanceof Error ? e : void 0)), e;
|
|
2836
2859
|
}
|
|
2837
2860
|
}));
|
|
2838
|
-
w(this,
|
|
2861
|
+
w(this, Kt, () => y(this, null, function* () {
|
|
2839
2862
|
const e = Date.now(), t = () => Date.now() - e;
|
|
2840
2863
|
return Promise.race([
|
|
2841
|
-
|
|
2864
|
+
xi(tt.PING_TIMEOUT),
|
|
2842
2865
|
fetch(new URL("/api/v4/connect/ping", this.config.options.get("url")).toString(), {
|
|
2843
2866
|
method: "HEAD"
|
|
2844
2867
|
})
|
|
2845
2868
|
]).then(t, t);
|
|
2846
2869
|
}));
|
|
2847
|
-
this.logger = t, this.emitter = e, this.config = s, this.apiClient = new
|
|
2870
|
+
this.logger = t, this.emitter = e, this.config = s, this.apiClient = new En({
|
|
2848
2871
|
publicEndpoint: this.config.options.get("url").toString(),
|
|
2849
2872
|
tokenFactory: () => this.config.options.get("authenticationToken")
|
|
2850
2873
|
});
|
|
@@ -2872,35 +2895,35 @@ const tt = class tt {
|
|
|
2872
2895
|
return (e = this.connectionImpl) == null ? void 0 : e.lastConnectionTime;
|
|
2873
2896
|
}
|
|
2874
2897
|
};
|
|
2875
|
-
he = new WeakMap(), dt = new WeakMap(), we = new WeakMap(), ht = new WeakMap(),
|
|
2898
|
+
he = new WeakMap(), dt = new WeakMap(), we = new WeakMap(), ht = new WeakMap(), Yt = new WeakMap(), Kt = new WeakMap(), $t = new WeakSet(), on = function() {
|
|
2876
2899
|
return y(this, null, function* () {
|
|
2877
2900
|
var t;
|
|
2878
|
-
const e = new
|
|
2879
|
-
for (
|
|
2901
|
+
const e = new va({ edgeUrl: this.config.options.get("edgeUrl") });
|
|
2902
|
+
for (S(this, we, 0); ; ) {
|
|
2880
2903
|
mt(this, we)._++;
|
|
2881
2904
|
try {
|
|
2882
|
-
const [r, o] = yield Promise.all([d(this,
|
|
2905
|
+
const [r, o] = yield Promise.all([d(this, Yt).call(this), d(this, Kt).call(this)]), a = o / 2;
|
|
2883
2906
|
if (!d(this, he))
|
|
2884
2907
|
break;
|
|
2885
2908
|
const c = e.select(r.edges);
|
|
2886
2909
|
if (!c)
|
|
2887
2910
|
throw new T("Failed to resolve edge url", { isFatal: !0, code: "failed_to_resolve_edge_url" });
|
|
2888
|
-
if (
|
|
2889
|
-
if (
|
|
2890
|
-
const { MoqConnectionAdapter: h } = yield import("./
|
|
2891
|
-
this.connectionImpl = yield h.start(this.emitter, this.logger,
|
|
2911
|
+
if (Cn(r)) {
|
|
2912
|
+
if (Xn().moqEnabled) {
|
|
2913
|
+
const { MoqConnectionAdapter: h } = yield import("./BRoNEXvE.js");
|
|
2914
|
+
this.connectionImpl = yield h.start(this.emitter, this.logger, this.apiClient, L(A({}, this.config), {
|
|
2892
2915
|
connectInfo: r,
|
|
2893
2916
|
estimatedRtt: a,
|
|
2894
2917
|
edgeUrl: c
|
|
2895
2918
|
}));
|
|
2896
2919
|
}
|
|
2897
2920
|
} else
|
|
2898
|
-
ae(typeof c == "string", "Edge URL is expected to be a string"), this.connectionImpl = yield
|
|
2921
|
+
ae(typeof c == "string", "Edge URL is expected to be a string"), this.connectionImpl = yield Oi.start(this.emitter, this.logger, L(A({}, this.config), {
|
|
2899
2922
|
connectInfo: r,
|
|
2900
2923
|
estimatedRtt: a,
|
|
2901
2924
|
edgeUrl: c
|
|
2902
2925
|
}));
|
|
2903
|
-
e.reset(), mt(this, ht)._++,
|
|
2926
|
+
e.reset(), mt(this, ht)._++, S(this, we, 0), yield this.connectionImpl.closed();
|
|
2904
2927
|
} catch (r) {
|
|
2905
2928
|
this.logger.info("Failed to connect", r);
|
|
2906
2929
|
const o = e.shiftedEdge();
|
|
@@ -2914,31 +2937,31 @@ he = new WeakMap(), dt = new WeakMap(), we = new WeakMap(), ht = new WeakMap(),
|
|
|
2914
2937
|
if (!(yield this.config.reconnectHandler({
|
|
2915
2938
|
reconnectRetries: d(this, we)
|
|
2916
2939
|
}))) {
|
|
2917
|
-
this.emitter.emit("error",
|
|
2940
|
+
this.emitter.emit("error", Xs());
|
|
2918
2941
|
break;
|
|
2919
2942
|
}
|
|
2920
|
-
if (yield
|
|
2943
|
+
if (yield xi(1e3), !d(this, he))
|
|
2921
2944
|
break;
|
|
2922
2945
|
}
|
|
2923
|
-
|
|
2946
|
+
S(this, dt, void 0);
|
|
2924
2947
|
});
|
|
2925
2948
|
}, n(tt, "PING_TIMEOUT", 1e3), n(tt, "create", (e, t, s) => new tt(e, t, s));
|
|
2926
|
-
let
|
|
2927
|
-
const
|
|
2928
|
-
video:
|
|
2949
|
+
let Fi = tt;
|
|
2950
|
+
const ki = () => ({
|
|
2951
|
+
video: L(A({}, Vt()), {
|
|
2929
2952
|
bitRate: ke()
|
|
2930
2953
|
}),
|
|
2931
2954
|
audio: {
|
|
2932
2955
|
bitRate: ke()
|
|
2933
2956
|
}
|
|
2934
|
-
}),
|
|
2957
|
+
}), ba = () => ({
|
|
2935
2958
|
width: window.innerWidth,
|
|
2936
2959
|
height: window.innerHeight,
|
|
2937
2960
|
bitRate: ke()
|
|
2938
2961
|
}), it = class it {
|
|
2939
2962
|
constructor(e, t, s, r) {
|
|
2940
2963
|
n(this, "emitter");
|
|
2941
|
-
n(this, "timers", new
|
|
2964
|
+
n(this, "timers", new q());
|
|
2942
2965
|
n(this, "pictureInPictureSource");
|
|
2943
2966
|
n(this, "element");
|
|
2944
2967
|
n(this, "currentCap");
|
|
@@ -2962,10 +2985,10 @@ const Bi = () => ({
|
|
|
2962
2985
|
});
|
|
2963
2986
|
n(this, "setUserSpecifiedCap", (e) => {
|
|
2964
2987
|
var s;
|
|
2965
|
-
const t = (s = this.getUserSpecifiedCap()) != null ? s :
|
|
2966
|
-
this.userSpecifiedCap =
|
|
2967
|
-
video:
|
|
2968
|
-
audio:
|
|
2988
|
+
const t = (s = this.getUserSpecifiedCap()) != null ? s : ki();
|
|
2989
|
+
this.userSpecifiedCap = L(A({}, t), {
|
|
2990
|
+
video: A(A({}, t.video), e.video),
|
|
2991
|
+
audio: A(A({}, t.audio), e.audio)
|
|
2969
2992
|
}), this.evaluateConstraintCap();
|
|
2970
2993
|
});
|
|
2971
2994
|
n(this, "getUserSpecifiedCap", () => this.userSpecifiedCap);
|
|
@@ -2989,7 +3012,7 @@ const Bi = () => ({
|
|
|
2989
3012
|
});
|
|
2990
3013
|
n(this, "evaluateConstraintCap", () => {
|
|
2991
3014
|
var a, c, h, u, l;
|
|
2992
|
-
const e = this.sizeBasedResolutionCapEnabled ?
|
|
3015
|
+
const e = this.sizeBasedResolutionCapEnabled ? L(A({}, ki()), { video: ba() }) : ki();
|
|
2993
3016
|
if (!this.resizeObserver) {
|
|
2994
3017
|
const m = this.element.getBoundingClientRect();
|
|
2995
3018
|
this.elementSize = { width: m.width, height: m.height };
|
|
@@ -3006,7 +3029,7 @@ const Bi = () => ({
|
|
|
3006
3029
|
});
|
|
3007
3030
|
s && s.video && (e.video.width = s.video.width, e.video.height = s.video.height);
|
|
3008
3031
|
const r = (c = this.userSpecifiedCap) == null ? void 0 : c.video, o = (h = this.userSpecifiedCap) == null ? void 0 : h.audio;
|
|
3009
|
-
r && e.video.width > r.width && e.video.height > r.height && (e.video.width = r.width, e.video.height = r.height), e.video.bitRate = (u = r == null ? void 0 : r.bitRate) != null ? u : e.video.bitRate, e.audio.bitRate = (l = o == null ? void 0 : o.bitRate) != null ? l : e.audio.bitRate, je(e, this.currentCap) ? this.currentCap =
|
|
3032
|
+
r && e.video.width > r.width && e.video.height > r.height && (e.video.width = r.width, e.video.height = r.height), e.video.bitRate = (u = r == null ? void 0 : r.bitRate) != null ? u : e.video.bitRate, e.audio.bitRate = (l = o == null ? void 0 : o.bitRate) != null ? l : e.audio.bitRate, je(e, this.currentCap) ? this.currentCap = A({}, e) : (this.currentCap = A({}, e), this.emitter.emit("constraint cap changed", e));
|
|
3010
3033
|
});
|
|
3011
3034
|
n(this, "enterPictureInPicture", (e) => {
|
|
3012
3035
|
this.pictureInPictureSource = e, this.evaluateConstraintCap();
|
|
@@ -3026,18 +3049,18 @@ const Bi = () => ({
|
|
|
3026
3049
|
}
|
|
3027
3050
|
};
|
|
3028
3051
|
n(it, "CHECK_SIZE_INTERVAL", 1e3), n(it, "create", (e, t, s, r) => new it(e, t, s, r));
|
|
3029
|
-
let
|
|
3030
|
-
const
|
|
3031
|
-
class
|
|
3052
|
+
let Ni = it;
|
|
3053
|
+
const ya = 5, Ea = 100, Ta = 1e3;
|
|
3054
|
+
class is {
|
|
3032
3055
|
constructor(e, t, s, r) {
|
|
3033
|
-
n(this, "timers",
|
|
3056
|
+
n(this, "timers", q.create());
|
|
3034
3057
|
n(this, "logger");
|
|
3035
3058
|
n(this, "emitter");
|
|
3036
3059
|
n(this, "trackContexts");
|
|
3037
3060
|
n(this, "playbackSource");
|
|
3038
3061
|
n(this, "isSuspended", !1);
|
|
3039
3062
|
n(this, "load", () => {
|
|
3040
|
-
this.timers.setInterval(this.emitDecodedFrames,
|
|
3063
|
+
this.timers.setInterval(this.emitDecodedFrames, Ea), this.timers.setInterval(this.emitDecodeRate, Ta), this.emitter.on("init segment", this.onInitSegment), this.emitter.on("coded sample", this.decode);
|
|
3041
3064
|
});
|
|
3042
3065
|
n(this, "unload", () => {
|
|
3043
3066
|
this.trackContexts.forEach(({ decoderContext: e }) => e.unload()), this.timers.unload(), this.emitter.off("init segment", this.onInitSegment), this.emitter.off("coded sample", this.decode);
|
|
@@ -3088,7 +3111,7 @@ class ts {
|
|
|
3088
3111
|
return;
|
|
3089
3112
|
t.sampleDuration = e.duration / e.timescale * 1e3;
|
|
3090
3113
|
const { decoderContext: s, buffer: r } = t, o = e.timestamp / e.timescale * 1e3, a = e.duration / e.timescale * 1e3, c = r[r.length - 1];
|
|
3091
|
-
!c || o -
|
|
3114
|
+
!c || o - ya > c.end ? r.push({ start: o, end: o + a }) : o + a * 5 < c.end ? t.buffer = [{ start: o, end: o + a }] : c.end = o + a, s.enqueue(e), this.emitDecodedFrames();
|
|
3092
3115
|
});
|
|
3093
3116
|
n(this, "emitDecodedFrames", () => {
|
|
3094
3117
|
let e;
|
|
@@ -3096,7 +3119,7 @@ class ts {
|
|
|
3096
3119
|
var r, o;
|
|
3097
3120
|
let s;
|
|
3098
3121
|
for (; (s = (o = (r = t.decoderContext).error) == null ? void 0 : o.call(r)) !== void 0; )
|
|
3099
|
-
this.emitter.emit("error",
|
|
3122
|
+
this.emitter.emit("error", hr(!1, s));
|
|
3100
3123
|
for (; (e = t.decoderContext.take()) !== void 0; ) {
|
|
3101
3124
|
const { statistics: a } = e;
|
|
3102
3125
|
a && (t.decodeTime.push(a.decodeTime), t.transportTime.push(
|
|
@@ -3137,33 +3160,33 @@ class ts {
|
|
|
3137
3160
|
for (const c of s)
|
|
3138
3161
|
switch (c.type) {
|
|
3139
3162
|
case "audio": {
|
|
3140
|
-
const { OpusDecoderContext: h } = yield import("./
|
|
3163
|
+
const { OpusDecoderContext: h } = yield import("./Ddff6fHr.js");
|
|
3141
3164
|
a.set(c.type, {
|
|
3142
3165
|
buffer: [],
|
|
3143
3166
|
decoderContext: yield h.create(48e3, 2),
|
|
3144
|
-
decodeTime: new
|
|
3145
|
-
transportTime: new
|
|
3167
|
+
decodeTime: new J(100),
|
|
3168
|
+
transportTime: new J(100),
|
|
3146
3169
|
sampleDuration: 40
|
|
3147
3170
|
});
|
|
3148
3171
|
break;
|
|
3149
3172
|
}
|
|
3150
3173
|
case "video": {
|
|
3151
|
-
const { H264DecoderWorkerContext: h } = yield import("./
|
|
3174
|
+
const { H264DecoderWorkerContext: h } = yield import("./DsS-0pTK.js");
|
|
3152
3175
|
a.set(c.type, {
|
|
3153
3176
|
buffer: [],
|
|
3154
3177
|
decoderContext: yield h.create(o),
|
|
3155
|
-
decodeTime: new
|
|
3156
|
-
transportTime: new
|
|
3178
|
+
decodeTime: new J(100),
|
|
3179
|
+
transportTime: new J(100),
|
|
3157
3180
|
sampleDuration: 40
|
|
3158
3181
|
});
|
|
3159
3182
|
break;
|
|
3160
3183
|
}
|
|
3161
3184
|
}
|
|
3162
|
-
return new
|
|
3185
|
+
return new is(e, t, a, r);
|
|
3163
3186
|
});
|
|
3164
3187
|
}
|
|
3165
3188
|
}
|
|
3166
|
-
const
|
|
3189
|
+
const ei = class ei {
|
|
3167
3190
|
constructor(e) {
|
|
3168
3191
|
n(this, "emitter");
|
|
3169
3192
|
n(this, "isVisibleCount", 0);
|
|
@@ -3213,16 +3236,16 @@ const Kt = class Kt {
|
|
|
3213
3236
|
return document.visibilityState === "visible";
|
|
3214
3237
|
}
|
|
3215
3238
|
};
|
|
3216
|
-
n(
|
|
3217
|
-
let
|
|
3218
|
-
const
|
|
3239
|
+
n(ei, "create", (e) => new ei(e));
|
|
3240
|
+
let Vi = ei;
|
|
3241
|
+
const Ca = (i) => (e, t, s) => e.timestamp <= t || e.timestampAdded <= s - i, be = class be {
|
|
3219
3242
|
constructor(e, t, s) {
|
|
3220
3243
|
n(this, "logger");
|
|
3221
3244
|
n(this, "emitter");
|
|
3222
3245
|
n(this, "waitingEvents", []);
|
|
3223
|
-
n(this, "isTriggered",
|
|
3246
|
+
n(this, "isTriggered", Ca(be.EVENT_TIMEOUT));
|
|
3224
3247
|
n(this, "timeSource");
|
|
3225
|
-
n(this, "timers", new
|
|
3248
|
+
n(this, "timers", new q());
|
|
3226
3249
|
n(this, "load", () => {
|
|
3227
3250
|
this.timers.setInterval(this.onBufferedStateChanged, be.EVENT_CHECK_INTERVAL), this.emitter.on("add event", this.addEvent);
|
|
3228
3251
|
});
|
|
@@ -3230,7 +3253,7 @@ const ya = (i) => (e, t, s) => e.timestamp <= t || e.timestampAdded <= s - i, be
|
|
|
3230
3253
|
this.timers.unload(), this.emitter.off("add event", this.addEvent);
|
|
3231
3254
|
});
|
|
3232
3255
|
n(this, "addEvent", (e) => {
|
|
3233
|
-
this.logger.debug("Adding event", { event: e }), !this.waitingEvents.some((t) => typeof t.id != "undefined" && t.id === e.id) && this.waitingEvents.push(
|
|
3256
|
+
this.logger.debug("Adding event", { event: e }), !this.waitingEvents.some((t) => typeof t.id != "undefined" && t.id === e.id) && this.waitingEvents.push(L(A({}, e), { timestampAdded: Date.now() }));
|
|
3234
3257
|
});
|
|
3235
3258
|
n(this, "extractEvent", (e, t) => {
|
|
3236
3259
|
t.type === "video" && e.channelId !== t.channelId && this.addEvent({
|
|
@@ -3257,11 +3280,11 @@ const ya = (i) => (e, t, s) => e.timestamp <= t || e.timestampAdded <= s - i, be
|
|
|
3257
3280
|
}
|
|
3258
3281
|
};
|
|
3259
3282
|
n(be, "EVENT_TIMEOUT", 5e3), n(be, "EVENT_CHECK_INTERVAL", 20), n(be, "create", (e, t, s) => new be(e, t, s));
|
|
3260
|
-
let
|
|
3283
|
+
let zi = be;
|
|
3261
3284
|
const ne = class ne {
|
|
3262
3285
|
constructor(e) {
|
|
3263
3286
|
n(this, "emitter");
|
|
3264
|
-
n(this, "timers",
|
|
3287
|
+
n(this, "timers", q.create());
|
|
3265
3288
|
n(this, "bytesReceived", /* @__PURE__ */ new Map());
|
|
3266
3289
|
n(this, "timeoutInterval");
|
|
3267
3290
|
n(this, "lastBytesUpdated", Date.now());
|
|
@@ -3283,7 +3306,7 @@ const ne = class ne {
|
|
|
3283
3306
|
});
|
|
3284
3307
|
n(this, "add", (e, t) => {
|
|
3285
3308
|
let s = this.bytesReceived.get(e);
|
|
3286
|
-
s || (s = new
|
|
3309
|
+
s || (s = new Vn(20), this.bytesReceived.set(e, s)), t > 0 && (this.lastBytesUpdated = Date.now(), this.timeoutInterval || (this.timeoutInterval = this.timers.setInterval(
|
|
3287
3310
|
this.checkTimeout,
|
|
3288
3311
|
ne.UPDATE_RECEIVED_BYTES_INTERVAL
|
|
3289
3312
|
))), s.add(t);
|
|
@@ -3302,7 +3325,7 @@ const ne = class ne {
|
|
|
3302
3325
|
n(this, "checkTimeout", () => {
|
|
3303
3326
|
const e = Date.now() - this.lastBytesUpdated;
|
|
3304
3327
|
if (this.totalBytesReceived() === 0 && e > ne.NO_DATA_ERROR_TIMEOUT) {
|
|
3305
|
-
this.emitter.emit("error",
|
|
3328
|
+
this.emitter.emit("error", Ar()), this.emitter.emit("reconnect", "no incoming data"), this.clearTimeoutInterval();
|
|
3306
3329
|
return;
|
|
3307
3330
|
}
|
|
3308
3331
|
e > ne.NO_DATA_TIMEOUT && this.totalBytesReceived() > 0 && (this.emitter.emit("no data timeout", this.totalBytesReceived()), this.clearTimeoutInterval());
|
|
@@ -3314,13 +3337,13 @@ const ne = class ne {
|
|
|
3314
3337
|
}
|
|
3315
3338
|
};
|
|
3316
3339
|
n(ne, "NO_DATA_ERROR_TIMEOUT", 20 * 1e3), n(ne, "NO_DATA_TIMEOUT", 5 * 1e3), n(ne, "UPDATE_RECEIVED_BYTES_INTERVAL", 1e3), n(ne, "create", (e) => new ne(e));
|
|
3317
|
-
let
|
|
3318
|
-
const
|
|
3340
|
+
let Hi = ne;
|
|
3341
|
+
const Ia = () => window.AudioContext || window.webkitAudioContext, ti = class ti extends Pe {
|
|
3319
3342
|
constructor() {
|
|
3320
3343
|
super();
|
|
3321
3344
|
// TODO: Checkout what happens when limit is reached
|
|
3322
|
-
n(this, "context", new (
|
|
3323
|
-
n(this, "timers",
|
|
3345
|
+
n(this, "context", new (Ia())());
|
|
3346
|
+
n(this, "timers", q.create());
|
|
3324
3347
|
n(this, "previousCurrentTime", 0);
|
|
3325
3348
|
n(this, "_isStuck", !1);
|
|
3326
3349
|
n(this, "mediaStreamDestination");
|
|
@@ -3333,7 +3356,7 @@ const Ea = () => window.AudioContext || window.webkitAudioContext, $t = class $t
|
|
|
3333
3356
|
n(this, "createSplitter", () => this.context.createChannelSplitter(2));
|
|
3334
3357
|
n(this, "resume", () => y(this, null, function* () {
|
|
3335
3358
|
try {
|
|
3336
|
-
return yield Promise.race([this.context.resume(),
|
|
3359
|
+
return yield Promise.race([this.context.resume(), Hn(1e3, lr())]);
|
|
3337
3360
|
} catch (t) {
|
|
3338
3361
|
throw this.suspend().catch(le), t;
|
|
3339
3362
|
}
|
|
@@ -3345,7 +3368,7 @@ const Ea = () => window.AudioContext || window.webkitAudioContext, $t = class $t
|
|
|
3345
3368
|
n(this, "onStateChange", () => this.emit("state", this.state));
|
|
3346
3369
|
this.context.addEventListener("statechange", this.onStateChange), this.timers.setInterval(() => {
|
|
3347
3370
|
this._isStuck = this.isRunning && this.context.currentTime === this.previousCurrentTime, this._isStuck && this.emit("stuck"), this.previousCurrentTime = this.context.currentTime;
|
|
3348
|
-
},
|
|
3371
|
+
}, ti.CHECK_INTERVAL);
|
|
3349
3372
|
}
|
|
3350
3373
|
get isStuck() {
|
|
3351
3374
|
return this._isStuck;
|
|
@@ -3363,9 +3386,9 @@ const Ea = () => window.AudioContext || window.webkitAudioContext, $t = class $t
|
|
|
3363
3386
|
return this.context.state;
|
|
3364
3387
|
}
|
|
3365
3388
|
};
|
|
3366
|
-
n(
|
|
3367
|
-
let
|
|
3368
|
-
const
|
|
3389
|
+
n(ti, "CHECK_INTERVAL", 1e3);
|
|
3390
|
+
let Qi = ti;
|
|
3391
|
+
const ii = class ii extends Pe {
|
|
3369
3392
|
constructor(t, s, { muted: r, reInitWhenStuck: o }) {
|
|
3370
3393
|
super();
|
|
3371
3394
|
n(this, "logger");
|
|
@@ -3380,8 +3403,8 @@ const ei = class ei extends Pe {
|
|
|
3380
3403
|
n(this, "samples", new Float32Array(new ArrayBuffer(5 * 960 * 4 * 2)));
|
|
3381
3404
|
// 100 ms flush interval
|
|
3382
3405
|
// 500 samples == max 10 seconds buffer for instant activation of audio (assuming that each sample has 960 samples and 48000hz)
|
|
3383
|
-
n(this, "preInitSampleQueue", new
|
|
3384
|
-
n(this, "unplayedBufferSources", new
|
|
3406
|
+
n(this, "preInitSampleQueue", new J(500));
|
|
3407
|
+
n(this, "unplayedBufferSources", new J(100));
|
|
3385
3408
|
n(this, "sampleRate", 48e3);
|
|
3386
3409
|
n(this, "channels", 2);
|
|
3387
3410
|
n(this, "index", 0);
|
|
@@ -3427,7 +3450,7 @@ const ei = class ei extends Pe {
|
|
|
3427
3450
|
n(this, "onDecodedFrame", (t) => {
|
|
3428
3451
|
if (!(this.gainNode && this.audio && this.audio.isRunning)) {
|
|
3429
3452
|
if (t.type === "audio") {
|
|
3430
|
-
this.preInitSampleQueue.push(
|
|
3453
|
+
this.preInitSampleQueue.push(L(A({}, t), { data: t.data.slice(0, t.data.length) }));
|
|
3431
3454
|
const s = this.clockSource.currentTime;
|
|
3432
3455
|
this.preInitSampleQueue.filterPop(({ timestamp: r, timescale: o }) => r / o * 1e3 > s);
|
|
3433
3456
|
}
|
|
@@ -3475,7 +3498,7 @@ const ei = class ei extends Pe {
|
|
|
3475
3498
|
n(this, "getAudioContext", () => this.audio ? this.audio : this.setupContext());
|
|
3476
3499
|
n(this, "setupContext", () => {
|
|
3477
3500
|
var t, s, r;
|
|
3478
|
-
return (t = this.audio) == null || t.unload(), this.audio = new
|
|
3501
|
+
return (t = this.audio) == null || t.unload(), this.audio = new Qi(), this.audio.on("state", (o) => {
|
|
3479
3502
|
this.logger.info("AudioContext state change", { state: o }), o === "running" && (this._muted = this._userProvidedMuted, this.setGain(this._volume)), !this.ignoreSuspendCalls && this.emit("state change", o);
|
|
3480
3503
|
}), this.audio.on("stuck", () => {
|
|
3481
3504
|
this.reInitWhenStuck && (this.logger.info("Re-init audio context"), this.setupContext(), this.resume().catch(le), this.emit("stuck"));
|
|
@@ -3533,13 +3556,13 @@ const ei = class ei extends Pe {
|
|
|
3533
3556
|
return (r = this.gainNode) == null || r.connect(s), s;
|
|
3534
3557
|
}
|
|
3535
3558
|
};
|
|
3536
|
-
n(
|
|
3537
|
-
let
|
|
3559
|
+
n(ii, "create", (t, s, r) => new ii(t, s, r));
|
|
3560
|
+
let Ht = ii;
|
|
3538
3561
|
var Be;
|
|
3539
|
-
class
|
|
3562
|
+
class an {
|
|
3540
3563
|
constructor() {
|
|
3541
3564
|
w(this, Be, []);
|
|
3542
|
-
|
|
3565
|
+
S(this, Be, []);
|
|
3543
3566
|
}
|
|
3544
3567
|
addTextTrack(e, t, s) {
|
|
3545
3568
|
const r = [], o = {
|
|
@@ -3573,12 +3596,12 @@ class rn {
|
|
|
3573
3596
|
}
|
|
3574
3597
|
}
|
|
3575
3598
|
Be = new WeakMap();
|
|
3576
|
-
const
|
|
3599
|
+
const Le = (i, e) => {
|
|
3577
3600
|
let t;
|
|
3578
3601
|
for (t = e; i > 1; i--) t += e;
|
|
3579
3602
|
return t;
|
|
3580
3603
|
};
|
|
3581
|
-
class
|
|
3604
|
+
class Ba {
|
|
3582
3605
|
constructor() {
|
|
3583
3606
|
n(this, "audio");
|
|
3584
3607
|
n(this, "unmute", () => this.audio.play().catch(le));
|
|
@@ -3586,18 +3609,18 @@ class Ta {
|
|
|
3586
3609
|
e.innerHTML = "<audio x-webkit-airplay='deny'></audio>";
|
|
3587
3610
|
const t = e.children.item(0);
|
|
3588
3611
|
if (t instanceof HTMLAudioElement)
|
|
3589
|
-
this.audio = t, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" +
|
|
3612
|
+
this.audio = t, this.audio.controls = !1, this.audio.disableRemotePlayback = !0, this.audio.preload = "auto", this.audio.src = "data:audio/mpeg;base64,//uQx" + Le(23, "A") + "WGluZwAAAA8AAAACAAACcQCA" + Le(16, "gICA") + Le(66, "/") + "8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkI" + Le(320, "A") + "//sQxAADgnABGiAAQBCqgCRMAAgEAH" + Le(15, "/") + "7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq" + Le(18, "/") + "9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAw" + Le(97, "V") + "Q==", this.audio.loop = !1, this.audio.load();
|
|
3590
3613
|
else
|
|
3591
3614
|
throw new Error("Failed to create audio tag");
|
|
3592
3615
|
}
|
|
3593
3616
|
}
|
|
3594
|
-
var
|
|
3595
|
-
class
|
|
3617
|
+
var Rt, ue, j, He, ee, cn, Ke, dn;
|
|
3618
|
+
class Ra {
|
|
3596
3619
|
constructor() {
|
|
3597
3620
|
w(this, ee);
|
|
3598
|
-
w(this,
|
|
3621
|
+
w(this, Rt, []);
|
|
3599
3622
|
w(this, ue, document.createElement("canvas"));
|
|
3600
|
-
w(this,
|
|
3623
|
+
w(this, j);
|
|
3601
3624
|
w(this, He, window.devicePixelRatio || 1);
|
|
3602
3625
|
n(this, "config", {
|
|
3603
3626
|
backgroundColor: "rgba(0,0,0,0.6)",
|
|
@@ -3608,19 +3631,19 @@ class Ca {
|
|
|
3608
3631
|
const e = d(this, ue).getContext("2d", { alpha: !0 });
|
|
3609
3632
|
if (!e)
|
|
3610
3633
|
throw new Error("Failed to create 2d context");
|
|
3611
|
-
|
|
3634
|
+
S(this, j, e), F(this, ee, Ke).call(this);
|
|
3612
3635
|
}
|
|
3613
3636
|
get canvas() {
|
|
3614
3637
|
return d(this, ue);
|
|
3615
3638
|
}
|
|
3616
3639
|
setActiveCues(e) {
|
|
3617
|
-
|
|
3640
|
+
S(this, Rt, e);
|
|
3618
3641
|
}
|
|
3619
3642
|
render(e, t = !1) {
|
|
3620
|
-
const s = d(this,
|
|
3621
|
-
`).flatMap((u) =>
|
|
3622
|
-
|
|
3623
|
-
const l = d(this,
|
|
3643
|
+
const s = d(this, Rt).flatMap((c) => c.text.split(`
|
|
3644
|
+
`).flatMap((u) => F(this, ee, dn).call(this, u, e.width)).map((u) => {
|
|
3645
|
+
F(this, ee, Ke).call(this);
|
|
3646
|
+
const l = d(this, j).measureText(u);
|
|
3624
3647
|
return {
|
|
3625
3648
|
text: u,
|
|
3626
3649
|
measurement: l,
|
|
@@ -3631,23 +3654,23 @@ class Ca {
|
|
|
3631
3654
|
};
|
|
3632
3655
|
})), r = Math.max(...s.map((c) => c.size.width)), o = s.reduce((c, { size: h }) => c + h.height, 0) + (s.length - 1) * this.config.lineGap;
|
|
3633
3656
|
let a = 0;
|
|
3634
|
-
|
|
3657
|
+
F(this, ee, cn).call(this, r, o), d(this, j).clearRect(0, 0, d(this, ue).width, d(this, ue).height);
|
|
3635
3658
|
for (const { size: c, text: h } of s)
|
|
3636
|
-
|
|
3637
|
-
t && (d(this,
|
|
3659
|
+
F(this, ee, Ke).call(this), d(this, j).fillStyle = this.config.backgroundColor, d(this, j).fillRect(0, a, c.width, c.height), F(this, ee, Ke).call(this), d(this, j).fillText(h, this.config.textPadding, a + this.config.textPadding), a += c.height + this.config.lineGap;
|
|
3660
|
+
t && (d(this, j).strokeStyle = "red", d(this, j).strokeRect(0, 0, e.width, d(this, ue).height));
|
|
3638
3661
|
}
|
|
3639
3662
|
}
|
|
3640
|
-
|
|
3641
|
-
d(this, ue).width = e * d(this, He), d(this, ue).height = t * d(this, He), d(this,
|
|
3663
|
+
Rt = new WeakMap(), ue = new WeakMap(), j = new WeakMap(), He = new WeakMap(), ee = new WeakSet(), cn = function(e, t) {
|
|
3664
|
+
d(this, ue).width = e * d(this, He), d(this, ue).height = t * d(this, He), d(this, j).scale(d(this, He), d(this, He)), this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`;
|
|
3642
3665
|
}, Ke = function() {
|
|
3643
|
-
d(this,
|
|
3644
|
-
},
|
|
3666
|
+
d(this, j).fillStyle = "white", d(this, j).textAlign = "left", d(this, j).textBaseline = "top", d(this, j).font = `${this.config.fontSize} sans-serif`;
|
|
3667
|
+
}, dn = function(e, t) {
|
|
3645
3668
|
const s = [], r = e.split(" ");
|
|
3646
3669
|
let o = "";
|
|
3647
3670
|
for (; r.length > 0; ) {
|
|
3648
|
-
|
|
3671
|
+
F(this, ee, Ke).call(this);
|
|
3649
3672
|
let a = 0;
|
|
3650
|
-
for (; d(this,
|
|
3673
|
+
for (; d(this, j).measureText(o + (o.length > 0 ? " " : "") + r[0]).width + this.config.textPadding * 2 <= t && r.length > 0; )
|
|
3651
3674
|
a++, o += (o.length > 0 ? " " : "") + r.shift();
|
|
3652
3675
|
if (a == 0) {
|
|
3653
3676
|
s.push(r.shift() || ""), o = "";
|
|
@@ -3657,7 +3680,7 @@ Bt = new WeakMap(), ue = new WeakMap(), W = new WeakMap(), He = new WeakMap(), e
|
|
|
3657
3680
|
}
|
|
3658
3681
|
return s;
|
|
3659
3682
|
};
|
|
3660
|
-
const
|
|
3683
|
+
const ka = `
|
|
3661
3684
|
precision mediump float;
|
|
3662
3685
|
uniform sampler2D texture;
|
|
3663
3686
|
|
|
@@ -3669,7 +3692,7 @@ void main() {
|
|
|
3669
3692
|
|
|
3670
3693
|
gl_FragColor = vec4(y, y, y, a);
|
|
3671
3694
|
}
|
|
3672
|
-
`,
|
|
3695
|
+
`, Pa = `
|
|
3673
3696
|
attribute vec2 position;
|
|
3674
3697
|
varying vec2 texture_coordinate;
|
|
3675
3698
|
uniform mat4 model;
|
|
@@ -3678,7 +3701,7 @@ void main() {
|
|
|
3678
3701
|
texture_coordinate = position;
|
|
3679
3702
|
gl_Position = model * vec4(position, 0.0, 1.0);
|
|
3680
3703
|
}
|
|
3681
|
-
`,
|
|
3704
|
+
`, Is = (i, e) => {
|
|
3682
3705
|
let t = i.getContext("webgl", e);
|
|
3683
3706
|
if (t || (t = i.getContext("experimental-webgl", e)), !t)
|
|
3684
3707
|
throw new T("Failed to create webgl context", {
|
|
@@ -3706,7 +3729,7 @@ void main() {
|
|
|
3706
3729
|
code: "failed_to_create_texture"
|
|
3707
3730
|
});
|
|
3708
3731
|
return i.bindTexture(i.TEXTURE_2D, e), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, i.NEAREST), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.NEAREST), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_S, i.CLAMP_TO_EDGE), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_T, i.CLAMP_TO_EDGE), e;
|
|
3709
|
-
},
|
|
3732
|
+
}, Bs = (i, e) => {
|
|
3710
3733
|
const t = i.createBuffer();
|
|
3711
3734
|
if (!t)
|
|
3712
3735
|
throw new T("Failed to create buffer", {
|
|
@@ -3714,7 +3737,7 @@ void main() {
|
|
|
3714
3737
|
code: "failed_to_create_buffer"
|
|
3715
3738
|
});
|
|
3716
3739
|
return i.bindBuffer(i.ARRAY_BUFFER, t), i.bufferData(i.ARRAY_BUFFER, e.buffer, i.STATIC_DRAW), t;
|
|
3717
|
-
},
|
|
3740
|
+
}, Xi = (i, e, t) => {
|
|
3718
3741
|
const s = i.createProgram();
|
|
3719
3742
|
if (!s)
|
|
3720
3743
|
throw new T("Failed to create program", {
|
|
@@ -3730,19 +3753,19 @@ void main() {
|
|
|
3730
3753
|
}
|
|
3731
3754
|
return s;
|
|
3732
3755
|
};
|
|
3733
|
-
var
|
|
3734
|
-
class
|
|
3756
|
+
var si, I, kt, Pt, xt, Re, ut, hn, un, ni;
|
|
3757
|
+
class xa {
|
|
3735
3758
|
constructor(e) {
|
|
3736
3759
|
w(this, ut);
|
|
3737
|
-
w(this,
|
|
3760
|
+
w(this, si, 96);
|
|
3738
3761
|
w(this, I);
|
|
3739
|
-
w(this, Rt);
|
|
3740
3762
|
w(this, kt);
|
|
3741
3763
|
w(this, Pt);
|
|
3764
|
+
w(this, xt);
|
|
3742
3765
|
w(this, Re);
|
|
3743
|
-
n(this, "subtitleRenderer", new
|
|
3766
|
+
n(this, "subtitleRenderer", new Ra());
|
|
3744
3767
|
// prettier-ignore
|
|
3745
|
-
w(this,
|
|
3768
|
+
w(this, ni, (e, t, s, r) => [
|
|
3746
3769
|
e,
|
|
3747
3770
|
0,
|
|
3748
3771
|
0,
|
|
@@ -3760,14 +3783,14 @@ class Ra {
|
|
|
3760
3783
|
0,
|
|
3761
3784
|
1
|
|
3762
3785
|
]);
|
|
3763
|
-
|
|
3786
|
+
S(this, I, e), S(this, kt, _e(e)), S(this, Pt, et(e, e.FRAGMENT_SHADER, ka)), S(this, xt, et(e, e.VERTEX_SHADER, Pa)), S(this, Re, Xi(e, d(this, xt), d(this, Pt))), this.subtitleRenderer.config.fontSize = "64px";
|
|
3764
3787
|
}
|
|
3765
3788
|
setActiveCues(e, t) {
|
|
3766
3789
|
this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t);
|
|
3767
3790
|
}
|
|
3768
3791
|
render(e) {
|
|
3769
|
-
const t = this.subtitleRenderer.canvas, s = (e.padding + d(this,
|
|
3770
|
-
t.width !== 0 && (d(this, I).useProgram(d(this, Re)),
|
|
3792
|
+
const t = this.subtitleRenderer.canvas, s = (e.padding + d(this, si)) * window.devicePixelRatio;
|
|
3793
|
+
t.width !== 0 && (d(this, I).useProgram(d(this, Re)), F(this, ut, hn).call(this), F(this, ut, un).call(this, this.subtitleRenderer.canvas.width / e.width, this.subtitleRenderer.canvas.height / e.height, -this.subtitleRenderer.canvas.width / e.width / 2, -(1 - (this.subtitleRenderer.canvas.height + s) / e.height)), d(this, I).uniform1i(d(this, I).getUniformLocation(d(this, Re), "texture"), 4), d(this, I).activeTexture(d(this, I).TEXTURE4), d(this, I).bindTexture(d(this, I).TEXTURE_2D, d(this, kt)), d(this, I).enable(d(this, I).BLEND), d(this, I).blendFunc(d(this, I).SRC_ALPHA, d(this, I).ONE_MINUS_SRC_ALPHA), d(this, I).texImage2D(
|
|
3771
3794
|
d(this, I).TEXTURE_2D,
|
|
3772
3795
|
0,
|
|
3773
3796
|
d(this, I).RGBA,
|
|
@@ -3777,14 +3800,14 @@ class Ra {
|
|
|
3777
3800
|
), d(this, I).texParameteri(d(this, I).TEXTURE_2D, d(this, I).TEXTURE_MAG_FILTER, d(this, I).LINEAR), d(this, I).drawArrays(d(this, I).TRIANGLE_STRIP, 0, 4));
|
|
3778
3801
|
}
|
|
3779
3802
|
}
|
|
3780
|
-
|
|
3803
|
+
si = new WeakMap(), I = new WeakMap(), kt = new WeakMap(), Pt = new WeakMap(), xt = new WeakMap(), Re = new WeakMap(), ut = new WeakSet(), hn = function() {
|
|
3781
3804
|
const e = d(this, I).getAttribLocation(d(this, Re), "position");
|
|
3782
3805
|
d(this, I).enableVertexAttribArray(e), d(this, I).vertexAttribPointer(e, 2, d(this, I).FLOAT, !1, 0, 0);
|
|
3783
|
-
},
|
|
3806
|
+
}, un = function(e, t, s, r) {
|
|
3784
3807
|
const o = d(this, I).getUniformLocation(d(this, Re), "model");
|
|
3785
|
-
d(this, I).uniformMatrix4fv(o, !1, d(this,
|
|
3786
|
-
},
|
|
3787
|
-
const
|
|
3808
|
+
d(this, I).uniformMatrix4fv(o, !1, d(this, ni).call(this, e, t, s, r));
|
|
3809
|
+
}, ni = new WeakMap();
|
|
3810
|
+
const Rs = `
|
|
3788
3811
|
precision mediump float;
|
|
3789
3812
|
uniform sampler2D y_texture;
|
|
3790
3813
|
uniform sampler2D u_texture;
|
|
@@ -3800,7 +3823,7 @@ void main() {
|
|
|
3800
3823
|
|
|
3801
3824
|
gl_FragColor = vec4(y, u, v, 1) * conversion;
|
|
3802
3825
|
}
|
|
3803
|
-
`,
|
|
3826
|
+
`, ks = `
|
|
3804
3827
|
attribute vec2 position;
|
|
3805
3828
|
varying vec2 texture_coordinate;
|
|
3806
3829
|
uniform mat4 model;
|
|
@@ -3809,27 +3832,27 @@ void main() {
|
|
|
3809
3832
|
texture_coordinate = position;
|
|
3810
3833
|
gl_Position = model * vec4(position, 0.0, 1.0);
|
|
3811
3834
|
}
|
|
3812
|
-
`,
|
|
3835
|
+
`, Ps = {
|
|
3813
3836
|
width: 256,
|
|
3814
3837
|
codedWidth: 256,
|
|
3815
3838
|
height: 144,
|
|
3816
3839
|
codedHeight: 144
|
|
3817
|
-
},
|
|
3840
|
+
}, xs = {
|
|
3818
3841
|
preserveDrawingBuffer: !1,
|
|
3819
3842
|
alpha: !1,
|
|
3820
3843
|
depth: !1,
|
|
3821
3844
|
stencil: !1,
|
|
3822
3845
|
antialias: !1,
|
|
3823
3846
|
premultipliedAlpha: !1
|
|
3824
|
-
},
|
|
3847
|
+
}, wt = class wt extends Pe {
|
|
3825
3848
|
constructor() {
|
|
3826
3849
|
super();
|
|
3827
3850
|
n(this, "canvas", document.createElement("canvas"));
|
|
3828
|
-
n(this, "context",
|
|
3829
|
-
n(this, "pixelShader", et(this.context, this.context.FRAGMENT_SHADER,
|
|
3830
|
-
n(this, "vertexShader", et(this.context, this.context.VERTEX_SHADER,
|
|
3831
|
-
n(this, "buffer",
|
|
3832
|
-
n(this, "program",
|
|
3851
|
+
n(this, "context", Is(this.canvas, xs));
|
|
3852
|
+
n(this, "pixelShader", et(this.context, this.context.FRAGMENT_SHADER, Rs));
|
|
3853
|
+
n(this, "vertexShader", et(this.context, this.context.VERTEX_SHADER, ks));
|
|
3854
|
+
n(this, "buffer", Bs(this.context, wt.SQUARE_VERTICES));
|
|
3855
|
+
n(this, "program", Xi(this.context, this.vertexShader, this.pixelShader));
|
|
3833
3856
|
n(this, "textures", {
|
|
3834
3857
|
y: _e(this.context),
|
|
3835
3858
|
u: _e(this.context),
|
|
@@ -3837,21 +3860,21 @@ void main() {
|
|
|
3837
3860
|
});
|
|
3838
3861
|
// Lazy loaded when needed
|
|
3839
3862
|
n(this, "textRenderer");
|
|
3840
|
-
n(this, "size",
|
|
3863
|
+
n(this, "size", Ps);
|
|
3841
3864
|
n(this, "onContextLost", (t) => {
|
|
3842
3865
|
this.textRenderer = void 0;
|
|
3843
3866
|
const s = new Error(t instanceof WebGLContextEvent ? t.statusMessage : "webgl context lost");
|
|
3844
|
-
this.emit("context lost",
|
|
3867
|
+
this.emit("context lost", pr(s)), t.preventDefault();
|
|
3845
3868
|
});
|
|
3846
3869
|
n(this, "onContextRestored", () => {
|
|
3847
|
-
this.emit("context restored"), this.context =
|
|
3870
|
+
this.emit("context restored"), this.context = Is(this.canvas, xs), this.pixelShader = et(this.context, this.context.FRAGMENT_SHADER, Rs), this.vertexShader = et(this.context, this.context.VERTEX_SHADER, ks), this.buffer = Bs(this.context, wt.SQUARE_VERTICES), this.program = Xi(this.context, this.vertexShader, this.pixelShader), this.textures = {
|
|
3848
3871
|
y: _e(this.context),
|
|
3849
3872
|
u: _e(this.context),
|
|
3850
3873
|
v: _e(this.context)
|
|
3851
3874
|
}, this.load();
|
|
3852
3875
|
});
|
|
3853
3876
|
n(this, "load", () => {
|
|
3854
|
-
this.context.useProgram(this.program), this.setupPositionVertexAttributes(), this.setSize(
|
|
3877
|
+
this.context.useProgram(this.program), this.setupPositionVertexAttributes(), this.setSize(Ps), this.context.uniform1i(this.context.getUniformLocation(this.program, "y_texture"), 0), this.context.uniform1i(this.context.getUniformLocation(this.program, "u_texture"), 1), this.context.uniform1i(this.context.getUniformLocation(this.program, "v_texture"), 2), this.setConversionMatrix(this.rec709());
|
|
3855
3878
|
});
|
|
3856
3879
|
n(this, "unload", () => {
|
|
3857
3880
|
var s;
|
|
@@ -3957,17 +3980,17 @@ void main() {
|
|
|
3957
3980
|
this.canvas.addEventListener("webglcontextlost", this.onContextLost), this.canvas.addEventListener("webglcontextrestored", this.onContextRestored, !1), this.canvas.style.width = "100%", this.canvas.style.position = "relative";
|
|
3958
3981
|
}
|
|
3959
3982
|
getTextRenderer() {
|
|
3960
|
-
return this.textRenderer || (this.textRenderer = new
|
|
3983
|
+
return this.textRenderer || (this.textRenderer = new xa(this.context)), this.textRenderer;
|
|
3961
3984
|
}
|
|
3962
3985
|
};
|
|
3963
|
-
n(
|
|
3964
|
-
let
|
|
3965
|
-
const
|
|
3986
|
+
n(wt, "SQUARE_VERTICES", new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]));
|
|
3987
|
+
let Gi = wt;
|
|
3988
|
+
const ri = class ri {
|
|
3966
3989
|
constructor(e, t, s, r) {
|
|
3967
3990
|
n(this, "oldTimestampLimit", 400);
|
|
3968
3991
|
n(this, "pool");
|
|
3969
3992
|
n(this, "logger");
|
|
3970
|
-
n(this, "videoRenderer", new
|
|
3993
|
+
n(this, "videoRenderer", new Gi());
|
|
3971
3994
|
n(this, "renderQueue", []);
|
|
3972
3995
|
n(this, "clockSource");
|
|
3973
3996
|
n(this, "isFirstFrame", !0);
|
|
@@ -4028,20 +4051,20 @@ const si = class si {
|
|
|
4028
4051
|
this.logger = e, this.clockSource = t, this.pool = s, this.renderTargetSize = r || this.videoRenderer.canvas;
|
|
4029
4052
|
}
|
|
4030
4053
|
};
|
|
4031
|
-
n(
|
|
4032
|
-
let
|
|
4033
|
-
const
|
|
4054
|
+
n(ri, "create", (e, t, s, r) => new ri(e, t, s, r));
|
|
4055
|
+
let Qt = ri;
|
|
4056
|
+
const oi = class oi {
|
|
4034
4057
|
constructor(e, t, s, r, o) {
|
|
4035
4058
|
n(this, "logger");
|
|
4036
4059
|
n(this, "emitter");
|
|
4037
4060
|
n(this, "audioPlayer");
|
|
4038
4061
|
n(this, "videoPlayer");
|
|
4039
4062
|
n(this, "pool");
|
|
4040
|
-
n(this, "unmuter", new
|
|
4063
|
+
n(this, "unmuter", new Ba());
|
|
4041
4064
|
n(this, "_isPaused", !1);
|
|
4042
4065
|
n(this, "isDisconnected", !1);
|
|
4043
|
-
n(this, "timers", new
|
|
4044
|
-
n(this, "textTracks", new
|
|
4066
|
+
n(this, "timers", new q());
|
|
4067
|
+
n(this, "textTracks", new an());
|
|
4045
4068
|
n(this, "playbackRate");
|
|
4046
4069
|
n(this, "reset", () => {
|
|
4047
4070
|
});
|
|
@@ -4075,11 +4098,11 @@ const ni = class ni {
|
|
|
4075
4098
|
try {
|
|
4076
4099
|
this.audioPlayer.onDecodedFrame(e);
|
|
4077
4100
|
} catch (t) {
|
|
4078
|
-
t instanceof Error && this.emitter.emit("error",
|
|
4101
|
+
t instanceof Error && this.emitter.emit("error", Hs(!1, t));
|
|
4079
4102
|
}
|
|
4080
4103
|
this.videoPlayer.onDecodedFrame(e);
|
|
4081
4104
|
});
|
|
4082
|
-
this.logger = t, this.emitter = e, this.pool = s, this.audioPlayer =
|
|
4105
|
+
this.logger = t, this.emitter = e, this.pool = s, this.audioPlayer = Ht.create(this.logger.createContext("AudioPlayerModule"), r, {
|
|
4083
4106
|
muted: o,
|
|
4084
4107
|
reInitWhenStuck: !0
|
|
4085
4108
|
}), this.audioPlayer.on("stuck", () => {
|
|
@@ -4089,7 +4112,7 @@ const ni = class ni {
|
|
|
4089
4112
|
volume: this.volume,
|
|
4090
4113
|
isMuted: this.muted
|
|
4091
4114
|
});
|
|
4092
|
-
}), this.videoPlayer =
|
|
4115
|
+
}), this.videoPlayer = Qt.create(this.logger.createContext("VideoPlayerModule"), this.audioPlayer, this.pool);
|
|
4093
4116
|
}
|
|
4094
4117
|
get volume() {
|
|
4095
4118
|
return this.audioPlayer.volume;
|
|
@@ -4142,9 +4165,9 @@ const ni = class ni {
|
|
|
4142
4165
|
this._isPaused = !0, this.audioPlayer.pause(), this.emitter.emit("media element state", "paused");
|
|
4143
4166
|
}
|
|
4144
4167
|
};
|
|
4145
|
-
n(
|
|
4146
|
-
let
|
|
4147
|
-
const
|
|
4168
|
+
n(oi, "create", (e, t, s, r, o) => new oi(e, t, s, r, o));
|
|
4169
|
+
let Wi = oi;
|
|
4170
|
+
const ai = class ai {
|
|
4148
4171
|
constructor(e, t, s, r, { muted: o, type: a, poster: c }) {
|
|
4149
4172
|
n(this, "logger");
|
|
4150
4173
|
n(this, "emitter");
|
|
@@ -4154,9 +4177,9 @@ const ri = class ri {
|
|
|
4154
4177
|
n(this, "pool");
|
|
4155
4178
|
n(this, "isDisconnected", !0);
|
|
4156
4179
|
n(this, "_userProvidedMuted", !1);
|
|
4157
|
-
n(this, "timers", new
|
|
4180
|
+
n(this, "timers", new q());
|
|
4158
4181
|
n(this, "volumeState");
|
|
4159
|
-
n(this, "textTracks", new
|
|
4182
|
+
n(this, "textTracks", new an());
|
|
4160
4183
|
n(this, "reset", () => {
|
|
4161
4184
|
});
|
|
4162
4185
|
n(this, "load", () => {
|
|
@@ -4198,7 +4221,7 @@ const ri = class ri {
|
|
|
4198
4221
|
try {
|
|
4199
4222
|
this.audioPlayer.onDecodedFrame(e);
|
|
4200
4223
|
} catch (t) {
|
|
4201
|
-
t instanceof Error && this.emitter.emit("error",
|
|
4224
|
+
t instanceof Error && this.emitter.emit("error", Hs(!1, t));
|
|
4202
4225
|
}
|
|
4203
4226
|
this.videoPlayer.onDecodedFrame(e);
|
|
4204
4227
|
});
|
|
@@ -4223,7 +4246,7 @@ const ri = class ri {
|
|
|
4223
4246
|
this.updateVolumeState(), !h.isMuted && !this.audioPlayer.isContextRunning && this.activateAudioPlayer().catch(le), h.isMuted || (this._userProvidedMuted = !1);
|
|
4224
4247
|
}), this.mediaElement.on("media element state", (h) => {
|
|
4225
4248
|
h === "paused" && this.audioPlayer.flushBuffer(), this.emitter.emit("media element state", h);
|
|
4226
|
-
}), this.audioPlayer =
|
|
4249
|
+
}), this.audioPlayer = Ht.create(this.logger.createContext("AudioPlayerModule"), r, {
|
|
4227
4250
|
muted: !1,
|
|
4228
4251
|
// Never muted because its the media element that limits audio output,
|
|
4229
4252
|
reInitWhenStuck: !1
|
|
@@ -4231,7 +4254,7 @@ const ri = class ri {
|
|
|
4231
4254
|
this.isDisconnected = !0;
|
|
4232
4255
|
}), this.audioPlayer.on("state change", (h) => {
|
|
4233
4256
|
h === "suspended" || h === "interrupted" ? this.mediaElement.muted = !0 : h === "running" && (this.mediaElement.muted = this._userProvidedMuted || document.visibilityState === "hidden"), this.updateVolumeState();
|
|
4234
|
-
}), this.videoPlayer =
|
|
4257
|
+
}), this.videoPlayer = Qt.create(
|
|
4235
4258
|
this.logger.createContext("VideoPlayerModule"),
|
|
4236
4259
|
this.audioPlayer,
|
|
4237
4260
|
this.pool,
|
|
@@ -4288,10 +4311,10 @@ const ri = class ri {
|
|
|
4288
4311
|
this.mediaElement.pause();
|
|
4289
4312
|
}
|
|
4290
4313
|
};
|
|
4291
|
-
n(
|
|
4292
|
-
let
|
|
4293
|
-
const
|
|
4294
|
-
class
|
|
4314
|
+
n(ai, "create", (e, t, s, r, o) => new ai(e, t, s, r, o));
|
|
4315
|
+
let ji = ai;
|
|
4316
|
+
const Ua = () => (i) => ln(i.buffered.start(0), i.buffered.end(i.buffered.length - 1)), ln = (i, e) => (t) => t.remove(Math.max(0, i), Math.min(Number.POSITIVE_INFINITY, e)), Us = (i) => (e) => e.appendBuffer(i), La = (i) => (e) => e.changeType(i), Ma = (i) => (e) => i(e);
|
|
4317
|
+
class _a {
|
|
4295
4318
|
constructor(e) {
|
|
4296
4319
|
n(this, "commandQueue", []);
|
|
4297
4320
|
n(this, "sourceBuffer");
|
|
@@ -4302,14 +4325,14 @@ class Ua {
|
|
|
4302
4325
|
});
|
|
4303
4326
|
n(this, "appendBuffer", (e, t) => new Promise((s, r) => {
|
|
4304
4327
|
if (t && this.currentInit !== t) {
|
|
4305
|
-
const a = new qe(
|
|
4328
|
+
const a = new qe(Us(t), s, r);
|
|
4306
4329
|
this.commandQueue.push(a), this.currentInit = t;
|
|
4307
4330
|
}
|
|
4308
|
-
const o = new qe(
|
|
4331
|
+
const o = new qe(Us(e), s, r);
|
|
4309
4332
|
this.commandQueue.push(o), this.handleQueue();
|
|
4310
4333
|
}));
|
|
4311
4334
|
n(this, "execute", (e) => new Promise((t, s) => {
|
|
4312
|
-
const r = new qe(
|
|
4335
|
+
const r = new qe(Ma(e), t, s);
|
|
4313
4336
|
this.commandQueue.push(r), this.handleQueue();
|
|
4314
4337
|
}));
|
|
4315
4338
|
n(this, "buffered", () => this.sourceBuffer.buffered);
|
|
@@ -4317,21 +4340,21 @@ class Ua {
|
|
|
4317
4340
|
e.removeSourceBuffer(this.sourceBuffer);
|
|
4318
4341
|
});
|
|
4319
4342
|
n(this, "changeType", (e) => new Promise((t, s) => {
|
|
4320
|
-
const r = new qe(
|
|
4343
|
+
const r = new qe(La(e), t, s);
|
|
4321
4344
|
this.commandQueue.push(r), this.handleQueue();
|
|
4322
4345
|
}));
|
|
4323
4346
|
n(this, "removeBuffer", (e, t) => new Promise((s, r) => {
|
|
4324
|
-
const o = new qe(
|
|
4347
|
+
const o = new qe(ln(e, t), s, r);
|
|
4325
4348
|
this.commandQueue.push(o), this.handleQueue();
|
|
4326
4349
|
}));
|
|
4327
4350
|
n(this, "flush", () => new Promise((e, t) => {
|
|
4328
|
-
const s = new qe(
|
|
4351
|
+
const s = new qe(Ua, e, t);
|
|
4329
4352
|
this.commandQueue.push(s), this.handleQueue();
|
|
4330
4353
|
}));
|
|
4331
4354
|
this.sourceBuffer = e, this.sourceBuffer.addEventListener("updateend", this.handleQueue);
|
|
4332
4355
|
}
|
|
4333
4356
|
}
|
|
4334
|
-
class
|
|
4357
|
+
class mn extends Pe {
|
|
4335
4358
|
constructor() {
|
|
4336
4359
|
super();
|
|
4337
4360
|
n(this, "MediaSource", vt());
|
|
@@ -4363,7 +4386,7 @@ class un extends Pe {
|
|
|
4363
4386
|
});
|
|
4364
4387
|
n(this, "addSourceBuffer", (t) => {
|
|
4365
4388
|
const s = this.mediaSource.addSourceBuffer(t);
|
|
4366
|
-
return new
|
|
4389
|
+
return new _a(s);
|
|
4367
4390
|
});
|
|
4368
4391
|
n(this, "removeSourceBuffer", (t) => {
|
|
4369
4392
|
t.removeFromMediaSource(this.mediaSource);
|
|
@@ -4389,11 +4412,11 @@ class un extends Pe {
|
|
|
4389
4412
|
this.mediaSource.addEventListener("sourceopen", this.onSourceOpen), this.mediaSource.addEventListener("sourceclose", this.onSourceClosed), this.mediaSource.addEventListener("sourceended", this.onSourceEnded);
|
|
4390
4413
|
}
|
|
4391
4414
|
}
|
|
4392
|
-
n(
|
|
4415
|
+
n(mn, "isTypeSupported", (t) => {
|
|
4393
4416
|
var s, r;
|
|
4394
4417
|
return (r = (s = vt()) == null ? void 0 : s.isTypeSupported(t)) != null ? r : !1;
|
|
4395
4418
|
});
|
|
4396
|
-
class
|
|
4419
|
+
class fn {
|
|
4397
4420
|
constructor() {
|
|
4398
4421
|
n(this, "initSegments", /* @__PURE__ */ new Map());
|
|
4399
4422
|
n(this, "set", (e, t, s) => {
|
|
@@ -4407,8 +4430,8 @@ class ln {
|
|
|
4407
4430
|
});
|
|
4408
4431
|
}
|
|
4409
4432
|
}
|
|
4410
|
-
function
|
|
4411
|
-
return
|
|
4433
|
+
function Da(i, { mediaSource: e, mimeType: t }) {
|
|
4434
|
+
return L(A({}, i), {
|
|
4412
4435
|
state: "initialized",
|
|
4413
4436
|
mimeType: t,
|
|
4414
4437
|
sourceBuffer: e.addSourceBuffer(t),
|
|
@@ -4417,13 +4440,13 @@ function Ma(i, { mediaSource: e, mimeType: t }) {
|
|
|
4417
4440
|
lastBufferCleanupTime: Date.now()
|
|
4418
4441
|
});
|
|
4419
4442
|
}
|
|
4420
|
-
function
|
|
4443
|
+
function Ls({
|
|
4421
4444
|
initSegments: i,
|
|
4422
4445
|
pendingSamples: e
|
|
4423
4446
|
}) {
|
|
4424
4447
|
return {
|
|
4425
4448
|
state: "uninitialized",
|
|
4426
|
-
initSegments: i != null ? i : new
|
|
4449
|
+
initSegments: i != null ? i : new fn(),
|
|
4427
4450
|
sequenceNumber: 0,
|
|
4428
4451
|
isWorkingOnPendingSamples: !1,
|
|
4429
4452
|
hasFirstSync: !!e,
|
|
@@ -4432,16 +4455,16 @@ function xs({
|
|
|
4432
4455
|
successfulAppendCalls: 0
|
|
4433
4456
|
};
|
|
4434
4457
|
}
|
|
4435
|
-
const
|
|
4458
|
+
const ci = class ci {
|
|
4436
4459
|
constructor(e, t, s) {
|
|
4437
4460
|
n(this, "maxChunkSize", 20);
|
|
4438
4461
|
n(this, "minConsecutiveErrorsBeforeEmit", 5);
|
|
4439
4462
|
n(this, "maxSecondsInBuffer", 60);
|
|
4440
4463
|
n(this, "logger");
|
|
4441
|
-
n(this, "timers",
|
|
4464
|
+
n(this, "timers", q.create());
|
|
4442
4465
|
n(this, "emitter");
|
|
4443
4466
|
n(this, "mediaElement");
|
|
4444
|
-
n(this, "mediaSource", new
|
|
4467
|
+
n(this, "mediaSource", new mn());
|
|
4445
4468
|
n(this, "trackContexts", /* @__PURE__ */ new Map());
|
|
4446
4469
|
n(this, "autoRecoverFromMediaErrors", !0);
|
|
4447
4470
|
n(this, "quotaErrorCount", 0);
|
|
@@ -4483,7 +4506,7 @@ const oi = class oi {
|
|
|
4483
4506
|
const r = (c = (a = e.get(s)) == null ? void 0 : a.pendingSamples) != null ? c : [], o = (h = e.get(s)) == null ? void 0 : h.initSegments;
|
|
4484
4507
|
for (; r.length > 0 && !((u = r[0]) != null && u.isSync); )
|
|
4485
4508
|
r.shift();
|
|
4486
|
-
this.trackContexts.set(s,
|
|
4509
|
+
this.trackContexts.set(s, Ls({ pendingSamples: r, initSegments: o }));
|
|
4487
4510
|
});
|
|
4488
4511
|
});
|
|
4489
4512
|
n(this, "setSourceBuffers", (e) => y(this, null, function* () {
|
|
@@ -4505,9 +4528,9 @@ const oi = class oi {
|
|
|
4505
4528
|
}
|
|
4506
4529
|
for (const s of e) {
|
|
4507
4530
|
let r = this.trackContexts.get(s.type);
|
|
4508
|
-
r || (r =
|
|
4531
|
+
r || (r = Ls({ pendingSamples: [], initSegments: new fn() }), this.trackContexts.set(s.type, r)), r.state === "initialized" ? s.mimeType !== r.mimeType && (yield r.sourceBuffer.changeType(s.mimeType)) : this.trackContexts.set(
|
|
4509
4532
|
s.type,
|
|
4510
|
-
|
|
4533
|
+
Da(r, { mimeType: s.mimeType, mediaSource: this.mediaSource })
|
|
4511
4534
|
);
|
|
4512
4535
|
}
|
|
4513
4536
|
}));
|
|
@@ -4533,9 +4556,9 @@ const oi = class oi {
|
|
|
4533
4556
|
this.logger.debug("Added init segment", { channel: e.channelId, renditionId: e.renditionId });
|
|
4534
4557
|
const s = this.trackContexts.get(e.type);
|
|
4535
4558
|
if (!s)
|
|
4536
|
-
throw
|
|
4559
|
+
throw _t(e.type, e.renditionId);
|
|
4537
4560
|
s.state === "initialized" && (s.mimeType = t);
|
|
4538
|
-
const r =
|
|
4561
|
+
const r = Qo(e.codec, e.data, e.timescale);
|
|
4539
4562
|
r && s.initSegments.set(e.channelId, e.renditionId, r);
|
|
4540
4563
|
});
|
|
4541
4564
|
n(this, "append", (e, t) => y(this, null, function* () {
|
|
@@ -4547,11 +4570,11 @@ const oi = class oi {
|
|
|
4547
4570
|
if (this.mediaSource.isClosed())
|
|
4548
4571
|
return;
|
|
4549
4572
|
if (!o)
|
|
4550
|
-
throw
|
|
4573
|
+
throw ur(s.renditionId, s.channelId);
|
|
4551
4574
|
if (!r)
|
|
4552
|
-
throw
|
|
4575
|
+
throw _t(s.type, s.renditionId);
|
|
4553
4576
|
if (r.state === "uninitialized")
|
|
4554
|
-
throw
|
|
4577
|
+
throw ms(s.type, s.renditionId);
|
|
4555
4578
|
if (t) {
|
|
4556
4579
|
const h = (s.timestamp + ((c = s.compositionTimeOffset) != null ? c : 0)) / s.timescale;
|
|
4557
4580
|
yield r.sourceBuffer.removeBuffer(h, Number.POSITIVE_INFINITY);
|
|
@@ -4567,7 +4590,7 @@ const oi = class oi {
|
|
|
4567
4590
|
a > 0 && Date.now() - r.lastBufferCleanupTime > 1e4 && (r.lastBufferCleanupTime = Date.now(), yield r.sourceBuffer.removeBuffer(0, a + 10));
|
|
4568
4591
|
try {
|
|
4569
4592
|
let h = r.sequenceNumber;
|
|
4570
|
-
const u =
|
|
4593
|
+
const u = Oa(e.map((l) => Zo(l, h++)));
|
|
4571
4594
|
yield r.sourceBuffer.appendBuffer(u), r.sequenceNumber = h, r.consecutiveQuotaExceededErrorCount = 0, r.successfulAppendCalls++;
|
|
4572
4595
|
} catch (h) {
|
|
4573
4596
|
throw h instanceof DOMException && (h.code === DOMException.QUOTA_EXCEEDED_ERR ? (this.quotaErrorCount++, r.consecutiveQuotaExceededErrorCount++, this.logger.error("quota exceeded error", { error: h }), r.pendingSamples.unshift(...e)) : this.mediaElement.error && r.pendingSamples.unshift(...e)), h;
|
|
@@ -4579,10 +4602,10 @@ const oi = class oi {
|
|
|
4579
4602
|
return;
|
|
4580
4603
|
const s = this.trackContexts.get(t);
|
|
4581
4604
|
if (!s)
|
|
4582
|
-
throw
|
|
4605
|
+
throw _t(t);
|
|
4583
4606
|
if (!this.mediaSource.isClosed()) {
|
|
4584
4607
|
if (s.state === "uninitialized")
|
|
4585
|
-
throw
|
|
4608
|
+
throw ms(t);
|
|
4586
4609
|
s.sourceBuffer.appendBuffer(e.rawBytes(), e.header().rawBytes()).catch((r) => console.log(r));
|
|
4587
4610
|
}
|
|
4588
4611
|
});
|
|
@@ -4591,22 +4614,22 @@ const oi = class oi {
|
|
|
4591
4614
|
return;
|
|
4592
4615
|
const t = this.trackContexts.get(e.type);
|
|
4593
4616
|
if (!t)
|
|
4594
|
-
throw
|
|
4617
|
+
throw _t(e.type, e.renditionId);
|
|
4595
4618
|
if (!(!t.hasFirstSync && !e.isSync)) {
|
|
4596
4619
|
if (this.hasAddedInitialPosterFrame && e.isSync && e.type === "video") {
|
|
4597
4620
|
this.hasAddedInitialPosterFrame = !1;
|
|
4598
|
-
const s =
|
|
4621
|
+
const s = A({}, e);
|
|
4599
4622
|
s.timestamp = 0, t.pendingSamples.push(s);
|
|
4600
4623
|
}
|
|
4601
|
-
t.hasFirstSync = !0, t.pendingSamples.push(e), t.state !== "uninitialized" && (t.isWorkingOnPendingSamples ||
|
|
4624
|
+
t.hasFirstSync = !0, t.pendingSamples.push(e), t.state !== "uninitialized" && (t.isWorkingOnPendingSamples || Fa(t, this.append, this.maxChunkSize).catch((s) => {
|
|
4602
4625
|
if (t.isWorkingOnPendingSamples = !1, s instanceof Error) {
|
|
4603
4626
|
if (this.logger.error("append failed", { message: s.message, name: s.name }), s instanceof DOMException && s.code === DOMException.QUOTA_EXCEEDED_ERR) {
|
|
4604
4627
|
if (t.consecutiveQuotaExceededErrorCount >= this.minConsecutiveErrorsBeforeEmit) {
|
|
4605
|
-
const r =
|
|
4628
|
+
const r = ls(!1, s, t.consecutiveQuotaExceededErrorCount, e.type);
|
|
4606
4629
|
this.emitter.emit("error", r);
|
|
4607
4630
|
}
|
|
4608
4631
|
} else {
|
|
4609
|
-
const r =
|
|
4632
|
+
const r = ls(!1, s, t.consecutiveQuotaExceededErrorCount, e.type);
|
|
4610
4633
|
this.emitter.emit("error", r);
|
|
4611
4634
|
}
|
|
4612
4635
|
this.mediaElement.error && this.onSourceEnded();
|
|
@@ -4620,7 +4643,7 @@ const oi = class oi {
|
|
|
4620
4643
|
n(this, "onSourceEnded", () => {
|
|
4621
4644
|
const { error: e } = this.mediaElement;
|
|
4622
4645
|
if (e) {
|
|
4623
|
-
const t = /AUDIO_RENDERER/.test(e.message) || !this.autoRecoverFromMediaErrors, s =
|
|
4646
|
+
const t = /AUDIO_RENDERER/.test(e.message) || !this.autoRecoverFromMediaErrors, s = dr(t, e);
|
|
4624
4647
|
if (this.logger.error("MediaElement error", { error: s }), this.emitter.emit("error", s), !s.isFatal()) {
|
|
4625
4648
|
this.logger.info("Re-opening MediaSource"), this.emitter.emit("recovered from media error", { error: s, count: this.recoveredFromErrorCount }), this.recoveredFromErrorCount++;
|
|
4626
4649
|
const r = !this.mediaElement.paused, o = [];
|
|
@@ -4634,40 +4657,40 @@ const oi = class oi {
|
|
|
4634
4657
|
this.logger = e, this.mediaElement = s, this.emitter = t;
|
|
4635
4658
|
}
|
|
4636
4659
|
};
|
|
4637
|
-
n(
|
|
4638
|
-
const r = new
|
|
4660
|
+
n(ci, "create", (e, t, s) => {
|
|
4661
|
+
const r = new ci(e, t, s);
|
|
4639
4662
|
return r.setTrackContexts(), r.mediaSource.on("source ended", r.onSourceEnded), r.mediaSource.on("source open", r.onSourceOpen), r.mediaSource.attach(s), r;
|
|
4640
4663
|
});
|
|
4641
|
-
let
|
|
4642
|
-
const
|
|
4664
|
+
let qi = ci;
|
|
4665
|
+
const Ms = (i, e) => {
|
|
4643
4666
|
var c;
|
|
4644
4667
|
const t = i.renditionId !== e.renditionId, s = i.channelId !== e.channelId, r = ((c = i.timestamp) != null ? c : 0) > e.timestamp, o = i.type === "video" && e.type === "video" && i.levelIdc !== e.levelIdc;
|
|
4645
4668
|
let a = !1;
|
|
4646
4669
|
return i.type === "video" && e.type === "video" && (a = e.width !== i.width || e.height !== i.height), s || t || r || a || o;
|
|
4647
|
-
},
|
|
4670
|
+
}, Oa = function(i) {
|
|
4648
4671
|
const e = i.reduce((r, o) => r + o.byteLength, 0), t = new Uint8Array(e);
|
|
4649
4672
|
let s = 0;
|
|
4650
4673
|
return i.forEach((r) => {
|
|
4651
4674
|
t.set(new Uint8Array(r), s), s += r.byteLength;
|
|
4652
4675
|
}), t.buffer;
|
|
4653
|
-
},
|
|
4676
|
+
}, Fa = (i, e, t) => y(void 0, null, function* () {
|
|
4654
4677
|
for (i.isWorkingOnPendingSamples = !0; i.pendingSamples.length > 0; ) {
|
|
4655
4678
|
const s = [];
|
|
4656
4679
|
let r = 0;
|
|
4657
4680
|
for (let c = 0; c < i.pendingSamples.length; c++) {
|
|
4658
4681
|
r = c;
|
|
4659
4682
|
const h = i.pendingSamples[c], u = i.pendingSamples[c + 1];
|
|
4660
|
-
if (h && (s.push(h), u &&
|
|
4683
|
+
if (h && (s.push(h), u && Ms(h, u)) || c === t - 1)
|
|
4661
4684
|
break;
|
|
4662
4685
|
}
|
|
4663
4686
|
const o = s[0];
|
|
4664
4687
|
if (!o)
|
|
4665
4688
|
break;
|
|
4666
|
-
const a = i.previousSample ?
|
|
4689
|
+
const a = i.previousSample ? Ms(i.previousSample, o) : !0;
|
|
4667
4690
|
yield e(s, a), i.pendingSamples = i.pendingSamples.slice(r + 1), i.previousSample = s[s.length - 1];
|
|
4668
4691
|
}
|
|
4669
4692
|
i.isWorkingOnPendingSamples = !1;
|
|
4670
|
-
}),
|
|
4693
|
+
}), di = class di {
|
|
4671
4694
|
constructor(e, t) {
|
|
4672
4695
|
n(this, "logger");
|
|
4673
4696
|
n(this, "emitter");
|
|
@@ -4709,9 +4732,9 @@ const Us = (i, e) => {
|
|
|
4709
4732
|
}
|
|
4710
4733
|
/* eslint-enable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-call */
|
|
4711
4734
|
};
|
|
4712
|
-
n(
|
|
4713
|
-
let
|
|
4714
|
-
const
|
|
4735
|
+
n(di, "create", (e, t) => new di(e, t));
|
|
4736
|
+
let Zi = di;
|
|
4737
|
+
const hi = class hi {
|
|
4715
4738
|
constructor(e, t, s, r) {
|
|
4716
4739
|
n(this, "emitter");
|
|
4717
4740
|
n(this, "logger");
|
|
@@ -4748,28 +4771,28 @@ const ci = class ci {
|
|
|
4748
4771
|
this.emitter = e, this.logger = t, this.clockSource = s, this.targetBufferTime = r, this.emitter.on("buffer state", this.onBufferedStateChanged), this.emitter.on("needs user input", this.onNeedsUserInput);
|
|
4749
4772
|
}
|
|
4750
4773
|
};
|
|
4751
|
-
n(
|
|
4752
|
-
let
|
|
4753
|
-
const
|
|
4774
|
+
n(hi, "create", (e, t, s, r) => new hi(e, t, s, r));
|
|
4775
|
+
let Ji = hi;
|
|
4776
|
+
const Yi = () => ({
|
|
4754
4777
|
upgradesFromLevel: [],
|
|
4755
4778
|
downgradesFromLevel: [],
|
|
4756
4779
|
bufferingRanges: [],
|
|
4757
4780
|
activeRanges: [],
|
|
4758
4781
|
decodeRate: Number.MAX_SAFE_INTEGER
|
|
4759
|
-
}),
|
|
4782
|
+
}), Na = () => ({
|
|
4760
4783
|
levels: {},
|
|
4761
4784
|
levelDowngrades: [],
|
|
4762
4785
|
levelUpgrades: [],
|
|
4763
4786
|
bufferFullness: 0,
|
|
4764
|
-
general:
|
|
4765
|
-
}),
|
|
4787
|
+
general: Yi()
|
|
4788
|
+
}), ui = class ui {
|
|
4766
4789
|
constructor(e, t) {
|
|
4767
4790
|
n(this, "minBufferFullnessLengthForRegression", 6);
|
|
4768
4791
|
n(this, "logger");
|
|
4769
4792
|
n(this, "emitter");
|
|
4770
|
-
n(this, "timers",
|
|
4771
|
-
n(this, "metrics",
|
|
4772
|
-
n(this, "bufferFullness", new
|
|
4793
|
+
n(this, "timers", q.create());
|
|
4794
|
+
n(this, "metrics", Na());
|
|
4795
|
+
n(this, "bufferFullness", new J(30));
|
|
4773
4796
|
n(this, "bufferFullnessRegression");
|
|
4774
4797
|
n(this, "currentLevel");
|
|
4775
4798
|
n(this, "isSuspended", !1);
|
|
@@ -4831,15 +4854,15 @@ const Ji = () => ({
|
|
|
4831
4854
|
return e;
|
|
4832
4855
|
});
|
|
4833
4856
|
n(this, "bufferingEventsLast", (e) => this.metrics.general.bufferingRanges.filter((t) => t.start >= Date.now() - e).length);
|
|
4834
|
-
n(this, "timeSpentBufferingLast", (e) =>
|
|
4835
|
-
n(this, "timeSpentActiveLast", (e) =>
|
|
4857
|
+
n(this, "timeSpentBufferingLast", (e) => ds(this.metrics.general.bufferingRanges, e));
|
|
4858
|
+
n(this, "timeSpentActiveLast", (e) => ds(this.metrics.general.activeRanges, e));
|
|
4836
4859
|
n(this, "timeSpentPlayingInAtLeastLevelRatio", (e) => {
|
|
4837
4860
|
var h, u, l, m;
|
|
4838
4861
|
const t = this.timeSpentBuffering(), s = this.timeActive(), r = this.bufferingRatios(), o = this.activeRatios(), a = ((u = (h = e.video) == null ? void 0 : h.bitRate) != null ? u : 0) + ((m = (l = e.audio) == null ? void 0 : l.bitRate) != null ? m : 0), c = t / s;
|
|
4839
4862
|
return Object.keys(this.metrics.levels).map((g) => parseInt(g, 10)).filter((g) => g >= a).reduce(
|
|
4840
4863
|
(g, p) => {
|
|
4841
|
-
var E,
|
|
4842
|
-
return ((E = o.get(p.toString())) != null ? E : 0) - ((
|
|
4864
|
+
var E, U;
|
|
4865
|
+
return ((E = o.get(p.toString())) != null ? E : 0) - ((U = r.get(p.toString())) != null ? U : 0) * c + g;
|
|
4843
4866
|
},
|
|
4844
4867
|
0
|
|
4845
4868
|
);
|
|
@@ -4853,18 +4876,18 @@ const Ji = () => ({
|
|
|
4853
4876
|
fatalQosCount: this.fatalQosCount
|
|
4854
4877
|
}));
|
|
4855
4878
|
n(this, "onRenditionLevelChanged", (e) => {
|
|
4856
|
-
var o, a, c, h, u, l, m, g, p, E,
|
|
4857
|
-
const t = ((c = (a = (o = e.from) == null ? void 0 : o.video) == null ? void 0 : a.bitRate) != null ? c : 0) + ((l = (u = (h = e.from) == null ? void 0 : h.audio) == null ? void 0 : u.bitRate) != null ? l : 0), s = ((p = (g = (m = e.to) == null ? void 0 : m.video) == null ? void 0 : g.bitRate) != null ? p : 0) + ((
|
|
4879
|
+
var o, a, c, h, u, l, m, g, p, E, U, N, G, M;
|
|
4880
|
+
const t = ((c = (a = (o = e.from) == null ? void 0 : o.video) == null ? void 0 : a.bitRate) != null ? c : 0) + ((l = (u = (h = e.from) == null ? void 0 : h.audio) == null ? void 0 : u.bitRate) != null ? l : 0), s = ((p = (g = (m = e.to) == null ? void 0 : m.video) == null ? void 0 : g.bitRate) != null ? p : 0) + ((N = (U = (E = e.to) == null ? void 0 : E.audio) == null ? void 0 : U.bitRate) != null ? N : 0);
|
|
4858
4881
|
this.logger.info("rendition level changed", { fromLevel: t, toLevel: s }), this.metrics.general.activeRanges.length === 0 && this.setActive(), e.from && e.to && (t < s ? this.metrics.general.upgradesFromLevel.push(Date.now()) : this.metrics.general.downgradesFromLevel.push(Date.now()));
|
|
4859
4882
|
let r = !1;
|
|
4860
4883
|
if (e.from) {
|
|
4861
|
-
const _ = (G = this.metrics.levels[t]) != null ? G :
|
|
4862
|
-
t < s ? _.upgradesFromLevel.push(Date.now()) : _.downgradesFromLevel.push(Date.now()),
|
|
4863
|
-
const
|
|
4864
|
-
r = !!
|
|
4884
|
+
const _ = (G = this.metrics.levels[t]) != null ? G : Yi();
|
|
4885
|
+
t < s ? _.upgradesFromLevel.push(Date.now()) : _.downgradesFromLevel.push(Date.now()), Me(_.activeRanges);
|
|
4886
|
+
const Z = _.bufferingRanges[_.bufferingRanges.length - 1];
|
|
4887
|
+
r = !!Z && !Z.end, Me(_.bufferingRanges), this.metrics.levels[t] = _;
|
|
4865
4888
|
}
|
|
4866
4889
|
if (e.to) {
|
|
4867
|
-
const _ = (
|
|
4890
|
+
const _ = (M = this.metrics.levels[s]) != null ? M : Yi();
|
|
4868
4891
|
Ze(_.activeRanges), r && Ze(_.bufferingRanges), this.metrics.levels[s] = _, this.currentLevel = s;
|
|
4869
4892
|
}
|
|
4870
4893
|
});
|
|
@@ -4888,7 +4911,7 @@ const Ji = () => ({
|
|
|
4888
4911
|
const t = this.metrics.levels[(s = this.currentLevel) != null ? s : 0];
|
|
4889
4912
|
t && (t.decodeRate = e);
|
|
4890
4913
|
});
|
|
4891
|
-
n(this, "calculateLinearRegression", () =>
|
|
4914
|
+
n(this, "calculateLinearRegression", () => Nn(
|
|
4892
4915
|
this.bufferFullness.items().map((e, t) => ({
|
|
4893
4916
|
x: t,
|
|
4894
4917
|
y: e
|
|
@@ -4897,9 +4920,9 @@ const Ji = () => ({
|
|
|
4897
4920
|
n(this, "stopBuffering", () => {
|
|
4898
4921
|
if (this.currentLevel) {
|
|
4899
4922
|
const e = this.metrics.levels[this.currentLevel];
|
|
4900
|
-
e &&
|
|
4923
|
+
e && Me(e.bufferingRanges);
|
|
4901
4924
|
}
|
|
4902
|
-
|
|
4925
|
+
Me(this.metrics.general.bufferingRanges);
|
|
4903
4926
|
});
|
|
4904
4927
|
n(this, "startBuffering", () => {
|
|
4905
4928
|
if (this.currentLevel) {
|
|
@@ -4911,9 +4934,9 @@ const Ji = () => ({
|
|
|
4911
4934
|
n(this, "unsetActive", () => {
|
|
4912
4935
|
if (this.currentLevel) {
|
|
4913
4936
|
const e = this.metrics.levels[this.currentLevel];
|
|
4914
|
-
e &&
|
|
4937
|
+
e && Me(e.activeRanges);
|
|
4915
4938
|
}
|
|
4916
|
-
|
|
4939
|
+
Me(this.metrics.general.activeRanges);
|
|
4917
4940
|
});
|
|
4918
4941
|
this.logger = t, this.emitter = e;
|
|
4919
4942
|
}
|
|
@@ -4928,9 +4951,9 @@ const Ji = () => ({
|
|
|
4928
4951
|
Ze(this.metrics.general.activeRanges);
|
|
4929
4952
|
}
|
|
4930
4953
|
};
|
|
4931
|
-
n(
|
|
4932
|
-
let
|
|
4933
|
-
const
|
|
4954
|
+
n(ui, "create", (e, t) => new ui(e, t));
|
|
4955
|
+
let Ki = ui;
|
|
4956
|
+
const li = class li {
|
|
4934
4957
|
constructor(e, t) {
|
|
4935
4958
|
n(this, "renditions", /* @__PURE__ */ new Map());
|
|
4936
4959
|
n(this, "renditionLevels", []);
|
|
@@ -5029,12 +5052,12 @@ const hi = class hi {
|
|
|
5029
5052
|
this.subscriptionSource = t, this.emitter = e, this.emitter.on("renditions", this.onRenditions), this.emitter.on("subscription changed", this.onSubscriptionChanged);
|
|
5030
5053
|
}
|
|
5031
5054
|
};
|
|
5032
|
-
n(
|
|
5033
|
-
let
|
|
5034
|
-
const
|
|
5055
|
+
n(li, "create", (e, t) => new li(e, t));
|
|
5056
|
+
let $i = li;
|
|
5057
|
+
const At = (i) => JSON.parse(JSON.stringify(i)), Va = 1e4, mi = class mi {
|
|
5035
5058
|
constructor(e, t, s) {
|
|
5036
5059
|
n(this, "logger");
|
|
5037
|
-
n(this, "timers", new
|
|
5060
|
+
n(this, "timers", new q());
|
|
5038
5061
|
n(this, "emitter");
|
|
5039
5062
|
n(this, "targetSubscription");
|
|
5040
5063
|
n(this, "currentSubscription");
|
|
@@ -5082,15 +5105,17 @@ const Ri = (i) => JSON.parse(JSON.stringify(i)), ui = class ui {
|
|
|
5082
5105
|
});
|
|
5083
5106
|
n(this, "isNewSubscription", () => {
|
|
5084
5107
|
const e = ["burstMs", "meta", "initiator", "channelGroupId"];
|
|
5085
|
-
return !je(
|
|
5108
|
+
return !je(cs(this.currentSubscription, e), cs(this.targetSubscription, e));
|
|
5086
5109
|
});
|
|
5087
|
-
n(this, "onSubscriptionChanged", ({ to: e }) => {
|
|
5088
|
-
this.logger.debug("onSubscriptionChanged", { to: e }), this.currentSubscription =
|
|
5110
|
+
n(this, "onSubscriptionChanged", ({ to: e, reset: t }) => {
|
|
5111
|
+
this.logger.debug("onSubscriptionChanged", { to: e, reset: t }), t ? this.targetSubscription = At(this.currentSubscription) : this.currentSubscription = At(e), this._isSwitchingSubscription = this.isNewSubscription();
|
|
5089
5112
|
});
|
|
5090
5113
|
n(this, "scheduleSubscriptionChange", () => {
|
|
5091
|
-
this.targetSubscription =
|
|
5092
|
-
const e = this.currentSubscription.channelId
|
|
5093
|
-
this._isSwitchingSubscription && (
|
|
5114
|
+
this.targetSubscription = At(this.targetSubscription), this._isSwitchingSubscription = this.isNewSubscription();
|
|
5115
|
+
const e = this.currentSubscription.channelId, t = this.targetSubscription.channelId, s = e !== t;
|
|
5116
|
+
this._isSwitchingSubscription && (s && this.burstMs ? this.setBurst(this.burstMs) : this.setBurst(0), this.pendingSubscriptionTimeoutId && (this.timers.clearTimeout(this.pendingSubscriptionTimeoutId), this.pendingSubscriptionTimeoutId = void 0), s && this.timers.setTimeout(() => {
|
|
5117
|
+
this.currentSubscription.channelId === e && this.targetSubscription.channelId === t && (this.logger.warn("Channel switch timeout", t), this.targetSubscription = At(this.currentSubscription), this.emitter.emit("channel switch timeout", t));
|
|
5118
|
+
}, Va), this.pendingSubscriptionTimeoutId = this.timers.setTimeout(
|
|
5094
5119
|
() => this.emitter.emit("send signal", {
|
|
5095
5120
|
type: "subscribe",
|
|
5096
5121
|
subscription: this.getTargetSubscription()
|
|
@@ -5098,18 +5123,18 @@ const Ri = (i) => JSON.parse(JSON.stringify(i)), ui = class ui {
|
|
|
5098
5123
|
0
|
|
5099
5124
|
));
|
|
5100
5125
|
});
|
|
5101
|
-
this.logger = e, this.targetSubscription = t, this.currentSubscription =
|
|
5126
|
+
this.logger = e, this.targetSubscription = t, this.currentSubscription = At(t), this.emitter = s, this.emitter.on("subscription changed", this.onSubscriptionChanged);
|
|
5102
5127
|
}
|
|
5103
5128
|
};
|
|
5104
|
-
n(
|
|
5105
|
-
let
|
|
5106
|
-
const
|
|
5129
|
+
n(mi, "create", (e, t, s) => new mi(e, s, t));
|
|
5130
|
+
let es = mi;
|
|
5131
|
+
const _s = 5e3, za = () => Vs() || pi() || Ln(), Ds = () => za() ? 100 : 0, Os = (i) => (e) => e > i, fi = class fi {
|
|
5107
5132
|
constructor(e, t, s, r, o) {
|
|
5108
5133
|
n(this, "emitter");
|
|
5109
5134
|
n(this, "logger");
|
|
5110
5135
|
n(this, "playbackSource");
|
|
5111
5136
|
n(this, "bufferSource");
|
|
5112
|
-
n(this, "keyframeTimestamps", new
|
|
5137
|
+
n(this, "keyframeTimestamps", new J(10));
|
|
5113
5138
|
n(this, "lastSeekTime", Date.now());
|
|
5114
5139
|
n(this, "seekCooldownTime", 1e3);
|
|
5115
5140
|
n(this, "seekTimeoutTime", 5e3);
|
|
@@ -5135,15 +5160,15 @@ const Ms = 5e3, Oa = () => Fs() || fi() || xn(), Ls = () => Oa() ? 100 : 0, _s =
|
|
|
5135
5160
|
maxBehind: 50,
|
|
5136
5161
|
multiplier: 1,
|
|
5137
5162
|
maxBehindAllowed: 600,
|
|
5138
|
-
overshoot:
|
|
5139
|
-
minOvershootAllowed:
|
|
5163
|
+
overshoot: Ds(),
|
|
5164
|
+
minOvershootAllowed: Ds(),
|
|
5140
5165
|
maxOvershootAllowed: 500
|
|
5141
5166
|
});
|
|
5142
5167
|
/**
|
|
5143
5168
|
* The max difference tolerated between server side sync info and local estimation
|
|
5144
5169
|
*/
|
|
5145
5170
|
n(this, "maxTimeSyncDifferenceTolerance", 150);
|
|
5146
|
-
n(this, "timers",
|
|
5171
|
+
n(this, "timers", q.create());
|
|
5147
5172
|
n(this, "rtt", 0);
|
|
5148
5173
|
n(this, "channelSyncInfo", /* @__PURE__ */ new Map());
|
|
5149
5174
|
n(this, "driftAdjustmentsCount", 0);
|
|
@@ -5232,7 +5257,7 @@ const Ms = 5e3, Oa = () => Fs() || fi() || xn(), Ls = () => Oa() ? 100 : 0, _s =
|
|
|
5232
5257
|
var r;
|
|
5233
5258
|
if (!e.channelId)
|
|
5234
5259
|
throw new Error("Sample must be assigned to a channel");
|
|
5235
|
-
this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 -
|
|
5260
|
+
this.currentChannelId || (this.currentChannelId = e.channelId), this.timestampOffset || (this.timestampOffset = e.timestamp / e.timescale * 1e3 - _s);
|
|
5236
5261
|
const t = e.type === "video" && e.isSync;
|
|
5237
5262
|
if (this.currentChannelId !== e.channelId) {
|
|
5238
5263
|
let o = Number.MAX_SAFE_INTEGER;
|
|
@@ -5255,7 +5280,7 @@ const Ms = 5e3, Oa = () => Fs() || fi() || xn(), Ls = () => Oa() ? 100 : 0, _s =
|
|
|
5255
5280
|
const s = t.mediaType();
|
|
5256
5281
|
if (!s)
|
|
5257
5282
|
throw new Error("Fragment must have a media type");
|
|
5258
|
-
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 -
|
|
5283
|
+
this.timestampOffset || (this.timestampOffset = t.baseMediaDecodeTime() / t.timescale() * 1e3 - _s);
|
|
5259
5284
|
const r = t.mediaType() === "video" && t.startsWithKeyframe();
|
|
5260
5285
|
this.currentChannelId !== e ? (console.assert(this.highestSeenTimestamps.size !== 0, "no known timestamps"), this.highestSeenTimestamps.forEach((c) => {
|
|
5261
5286
|
}), this.currentChannelId = e) : (r || this.timeshiftOnAudio) && this.tryTimeshiftSync();
|
|
@@ -5301,7 +5326,7 @@ const Ms = 5e3, Oa = () => Fs() || fi() || xn(), Ls = () => Oa() ? 100 : 0, _s =
|
|
|
5301
5326
|
}
|
|
5302
5327
|
if (!this.timestampOffset)
|
|
5303
5328
|
return;
|
|
5304
|
-
const t = Date.now() - this.seekTimeoutTime * this.timeshiftSync.multiplier, s = this.timeShiftAdjustments.filter(
|
|
5329
|
+
const t = Date.now() - this.seekTimeoutTime * this.timeshiftSync.multiplier, s = this.timeShiftAdjustments.filter(Os(t)).length;
|
|
5305
5330
|
if (s && this.timeshiftSync.multiplier > 2)
|
|
5306
5331
|
return this.logger.debug("Too many diff timeShifts within sliding window", {
|
|
5307
5332
|
timeShiftsCooldownMs: t,
|
|
@@ -5329,7 +5354,7 @@ const Ms = 5e3, Oa = () => Fs() || fi() || xn(), Ls = () => Oa() ? 100 : 0, _s =
|
|
|
5329
5354
|
const e = (c = this.drift) != null ? c : 0;
|
|
5330
5355
|
if (e < 0 && -e < this.currentSyncMaxAhead() || e > 0 && e < this.currentSyncMaxBehind() || Math.abs(e) < 1 || !this.isSeekCooldownExpired())
|
|
5331
5356
|
return;
|
|
5332
|
-
const t = Date.now() - this.seekTimeoutTime * this.syncMaxBehindMultiplier, s = this.driftAdjustments.filter(
|
|
5357
|
+
const t = Date.now() - this.seekTimeoutTime * this.syncMaxBehindMultiplier, s = this.driftAdjustments.filter(Os(t)).length;
|
|
5333
5358
|
if (s && this.syncMaxBehindMultiplier > 2)
|
|
5334
5359
|
return this.logger.debug("Too many diff adjustments within sliding window", {
|
|
5335
5360
|
adjustmentsCooldownMs: t,
|
|
@@ -5363,7 +5388,7 @@ const Ms = 5e3, Oa = () => Fs() || fi() || xn(), Ls = () => Oa() ? 100 : 0, _s =
|
|
|
5363
5388
|
if (this.isSuspended)
|
|
5364
5389
|
return;
|
|
5365
5390
|
if (!r || !o) {
|
|
5366
|
-
this.logger.info("Initial timing info", { syncInfo: t }), this.channelSyncInfo.set(e,
|
|
5391
|
+
this.logger.info("Initial timing info", { syncInfo: t }), this.channelSyncInfo.set(e, L(A({}, t), { localTimestamp: s, timeDifferences: new J(12) }));
|
|
5367
5392
|
return;
|
|
5368
5393
|
}
|
|
5369
5394
|
const a = t.wallclockTime - r.wallclockTime, c = t.timestamp - r.timestamp, h = s - r.localTimestamp, u = c - h;
|
|
@@ -5377,9 +5402,9 @@ const Ms = 5e3, Oa = () => Fs() || fi() || xn(), Ls = () => Oa() ? 100 : 0, _s =
|
|
|
5377
5402
|
wallclockDelta: a,
|
|
5378
5403
|
localWallclockDelta: h
|
|
5379
5404
|
}), Math.abs(u) >= this.bufferSource.getTargetBufferTime() * 2) {
|
|
5380
|
-
this.logger.info("Resetting sync info", { diffFromEstimated: u }), this.channelSyncInfo.set(e,
|
|
5405
|
+
this.logger.info("Resetting sync info", { diffFromEstimated: u }), this.channelSyncInfo.set(e, L(A({}, t), {
|
|
5381
5406
|
localTimestamp: s,
|
|
5382
|
-
timeDifferences: new
|
|
5407
|
+
timeDifferences: new J(r.timeDifferences.maxSize + 1)
|
|
5383
5408
|
})), this.currentChannelId && this.currentChannelId === e && (this.reset(), this.emitter.emit("channel reset"));
|
|
5384
5409
|
return;
|
|
5385
5410
|
}
|
|
@@ -5392,7 +5417,7 @@ const Ms = 5e3, Oa = () => Fs() || fi() || xn(), Ls = () => Oa() ? 100 : 0, _s =
|
|
|
5392
5417
|
const s = this.channelSyncInfo.get(t);
|
|
5393
5418
|
if (!s)
|
|
5394
5419
|
return;
|
|
5395
|
-
const r =
|
|
5420
|
+
const r = Ut(s.timeDifferences.items());
|
|
5396
5421
|
Math.abs(r) > e && (this.logger.info("Adjusting sync info", { averageDifference: r }), s.timestamp += r, s.timeDifferences.clear());
|
|
5397
5422
|
}
|
|
5398
5423
|
/**
|
|
@@ -5412,9 +5437,9 @@ const Ms = 5e3, Oa = () => Fs() || fi() || xn(), Ls = () => Oa() ? 100 : 0, _s =
|
|
|
5412
5437
|
return this.serverCurrentTime - this.playbackSource.currentTime;
|
|
5413
5438
|
}
|
|
5414
5439
|
};
|
|
5415
|
-
n(
|
|
5416
|
-
let
|
|
5417
|
-
const
|
|
5440
|
+
n(fi, "create", (e, t, s, r, o) => new fi(e, t, s, r, o));
|
|
5441
|
+
let ts = fi;
|
|
5442
|
+
const Ha = {
|
|
5418
5443
|
enabled: !0,
|
|
5419
5444
|
interval: 3e4,
|
|
5420
5445
|
includeErrors: !0,
|
|
@@ -5423,14 +5448,14 @@ const Fa = {
|
|
|
5423
5448
|
maxRetries: 10,
|
|
5424
5449
|
maxErrorReports: 50,
|
|
5425
5450
|
maxEvents: 50
|
|
5426
|
-
},
|
|
5451
|
+
}, Pi = (i, e) => L(A({}, e), { type: i, timestamp: (/* @__PURE__ */ new Date()).toISOString(), discriminator: "web" }), Ai = class Ai {
|
|
5427
5452
|
constructor(e, t, s, r) {
|
|
5428
5453
|
n(this, "logger");
|
|
5429
|
-
n(this, "timers", new
|
|
5454
|
+
n(this, "timers", new q());
|
|
5430
5455
|
n(this, "emitter");
|
|
5431
5456
|
n(this, "options");
|
|
5432
5457
|
n(this, "parentContext");
|
|
5433
|
-
n(this, "unsentLines", new
|
|
5458
|
+
n(this, "unsentLines", new J(100));
|
|
5434
5459
|
n(this, "retries", 0);
|
|
5435
5460
|
n(this, "errorCount", 0);
|
|
5436
5461
|
n(this, "eventCount", 0);
|
|
@@ -5446,13 +5471,13 @@ const Fa = {
|
|
|
5446
5471
|
n(this, "addStats", ({ isFinal: e, initiator: t } = { isFinal: !1, initiator: "interval" }, s = {}) => {
|
|
5447
5472
|
if (!this.options.includeStats)
|
|
5448
5473
|
return;
|
|
5449
|
-
const r = this.parentContext.getStatistics(), o =
|
|
5474
|
+
const r = this.parentContext.getStatistics(), o = Pi("stats", L(A(A({}, s), r), { isFinal: e, initiator: t, count: this.statsCount++ }));
|
|
5450
5475
|
this.unsentLines.push(o);
|
|
5451
5476
|
});
|
|
5452
5477
|
n(this, "addEvent", (e) => {
|
|
5453
5478
|
if (!this.options.includeEvents || this.eventCount > this.options.maxEvents)
|
|
5454
5479
|
return;
|
|
5455
|
-
const t = this.parentContext.getStatistics(), s =
|
|
5480
|
+
const t = this.parentContext.getStatistics(), s = Pi("event", A(A({}, t), e));
|
|
5456
5481
|
this.eventCount++, this.unsentLines.push(s);
|
|
5457
5482
|
});
|
|
5458
5483
|
n(this, "getStatistics", () => ({
|
|
@@ -5473,7 +5498,7 @@ const Fa = {
|
|
|
5473
5498
|
this.parentContext.connectionState === "connected" ? this.emitter.emit("send signal", {
|
|
5474
5499
|
type: "telemetry",
|
|
5475
5500
|
body: t
|
|
5476
|
-
}) : yield
|
|
5501
|
+
}) : yield In(new URL(this.options.url), { body: t, headers: { "Content-Type": "text/plain" } });
|
|
5477
5502
|
break;
|
|
5478
5503
|
}
|
|
5479
5504
|
this.retries = 0, this.unsentLines.clear();
|
|
@@ -5497,21 +5522,21 @@ const Fa = {
|
|
|
5497
5522
|
return;
|
|
5498
5523
|
const r = this.parentContext.getStatistics();
|
|
5499
5524
|
this.unsentLines.push(
|
|
5500
|
-
|
|
5525
|
+
Pi("error", A(A({}, r), e.toStringifiable()))
|
|
5501
5526
|
);
|
|
5502
5527
|
}
|
|
5503
5528
|
});
|
|
5504
|
-
this.logger = e, this.emitter = t, this.options =
|
|
5529
|
+
this.logger = e, this.emitter = t, this.options = A(A({}, Ha), s), this.parentContext = r;
|
|
5505
5530
|
}
|
|
5506
5531
|
};
|
|
5507
|
-
n(
|
|
5508
|
-
let
|
|
5509
|
-
const
|
|
5532
|
+
n(Ai, "create", (e, t, s, r) => new Ai(e, t, s, r));
|
|
5533
|
+
let Xt = Ai;
|
|
5534
|
+
const gi = class gi {
|
|
5510
5535
|
constructor(e, t, s) {
|
|
5511
5536
|
n(this, "logger");
|
|
5512
5537
|
n(this, "element");
|
|
5513
5538
|
n(this, "documentState");
|
|
5514
|
-
n(this, "timers", new
|
|
5539
|
+
n(this, "timers", new q());
|
|
5515
5540
|
n(this, "unload", () => {
|
|
5516
5541
|
this.timers.unload();
|
|
5517
5542
|
});
|
|
@@ -5521,15 +5546,15 @@ const Ai = class Ai {
|
|
|
5521
5546
|
this.logger = e, this.element = t, this.documentState = s, this.timers.setInterval(this.unpause, 100);
|
|
5522
5547
|
}
|
|
5523
5548
|
};
|
|
5524
|
-
n(
|
|
5525
|
-
let
|
|
5526
|
-
const
|
|
5549
|
+
n(gi, "create", (e, t, s) => new gi(e, t, s));
|
|
5550
|
+
let Gt = gi;
|
|
5551
|
+
const Qa = 6, Xa = (i) => {
|
|
5527
5552
|
let e = [i], t = 0, s = 0, r = !1;
|
|
5528
5553
|
const o = (c, h) => {
|
|
5529
|
-
var
|
|
5530
|
-
c.flags &&
|
|
5531
|
-
const u = c.timestamp / c.timescale, m = h.flags &&
|
|
5532
|
-
return E > 0 && (s = E),
|
|
5554
|
+
var N, G, M;
|
|
5555
|
+
c.flags && pt(c.flags) && (t = (N = c.compositionTimeOffset) != null ? N : 0), c.timestamp += t, c.compositionTimeOffset = ((G = c.compositionTimeOffset) != null ? G : 0) - t;
|
|
5556
|
+
const u = c.timestamp / c.timescale, m = h.flags && pt(h.flags) ? (M = h.compositionTimeOffset) != null ? M : 0 : t, p = (h.timestamp + m) / h.timescale, E = Math.max(0, Math.round((p - u) * c.timescale));
|
|
5557
|
+
return E > 0 && (s = E), L(A({}, c), {
|
|
5533
5558
|
/*
|
|
5534
5559
|
During resync timeshifts we may end up with negative durations (normalized to 0 above) which is not allowed in mse (the MseModule
|
|
5535
5560
|
drops the frame) so we use the last known duration instead. This is not ideal but it's better than dropping the frame.
|
|
@@ -5538,7 +5563,7 @@ const Na = 6, Va = (i) => {
|
|
|
5538
5563
|
});
|
|
5539
5564
|
};
|
|
5540
5565
|
return (c, h = !1) => {
|
|
5541
|
-
if (c.flags &&
|
|
5566
|
+
if (c.flags && pt(c.flags) && h && (r = !r), !(h && e.length < Qa && r) && e.length > 0) {
|
|
5542
5567
|
r = !1;
|
|
5543
5568
|
let l = c;
|
|
5544
5569
|
for (let g = e.length - 1; g > 0; g--) {
|
|
@@ -5554,12 +5579,12 @@ const Na = 6, Va = (i) => {
|
|
|
5554
5579
|
}
|
|
5555
5580
|
return e.push(c), [];
|
|
5556
5581
|
};
|
|
5557
|
-
},
|
|
5582
|
+
}, Ga = (i, e, t) => {
|
|
5558
5583
|
if (st(e))
|
|
5559
|
-
return
|
|
5584
|
+
return A(L(A({}, i), {
|
|
5560
5585
|
type: "video",
|
|
5561
5586
|
codec: e.codec,
|
|
5562
|
-
isSync:
|
|
5587
|
+
isSync: pt(i.flags),
|
|
5563
5588
|
data: i.payload,
|
|
5564
5589
|
duration: 0,
|
|
5565
5590
|
width: e.width,
|
|
@@ -5567,18 +5592,18 @@ const Na = 6, Va = (i) => {
|
|
|
5567
5592
|
}), t);
|
|
5568
5593
|
if (e.codec === "webvtt")
|
|
5569
5594
|
throw new Error("WebVTT is not supported");
|
|
5570
|
-
return
|
|
5595
|
+
return L(A({}, i), {
|
|
5571
5596
|
type: "audio",
|
|
5572
5597
|
channels: e.channels,
|
|
5573
5598
|
sampleRate: e.sampleRate,
|
|
5574
5599
|
codec: e.codec,
|
|
5575
5600
|
language: e.language,
|
|
5576
|
-
isSync:
|
|
5601
|
+
isSync: pt(i.flags),
|
|
5577
5602
|
data: i.payload,
|
|
5578
5603
|
duration: 0
|
|
5579
5604
|
});
|
|
5580
5605
|
};
|
|
5581
|
-
class
|
|
5606
|
+
class Wa {
|
|
5582
5607
|
constructor() {
|
|
5583
5608
|
n(this, "highEntropyValues");
|
|
5584
5609
|
var e;
|
|
@@ -5597,17 +5622,17 @@ class Ha {
|
|
|
5597
5622
|
};
|
|
5598
5623
|
if (self.navigator.userAgentData && this.highEntropyValues) {
|
|
5599
5624
|
const m = "1", g = [...(a = this.highEntropyValues.brands) != null ? a : []];
|
|
5600
|
-
g.sort((
|
|
5625
|
+
g.sort((M, _) => M.brand.localeCompare(_.brand));
|
|
5601
5626
|
const p = [...(c = this.highEntropyValues.fullVersionList) != null ? c : []];
|
|
5602
|
-
p.sort((
|
|
5603
|
-
const E = p.map((
|
|
5604
|
-
return
|
|
5627
|
+
p.sort((M, _) => M.brand.localeCompare(_.brand));
|
|
5628
|
+
const E = p.map((M) => M.version), U = g.map((M) => M.brand), N = g.map((M) => M.version), G = parseInt((u = (h = this.highEntropyValues.platformVersion) == null ? void 0 : h.split(".")[0]) != null ? u : m);
|
|
5629
|
+
return A({
|
|
5605
5630
|
userAgentLegacy: window.navigator.userAgent,
|
|
5606
5631
|
ua: {
|
|
5607
5632
|
browser: {
|
|
5608
|
-
brands:
|
|
5633
|
+
brands: U,
|
|
5609
5634
|
fullVersionBrands: E,
|
|
5610
|
-
majorVersions:
|
|
5635
|
+
majorVersions: N
|
|
5611
5636
|
},
|
|
5612
5637
|
device: this.highEntropyValues.model || "Other",
|
|
5613
5638
|
os: {
|
|
@@ -5618,12 +5643,12 @@ class Ha {
|
|
|
5618
5643
|
}
|
|
5619
5644
|
}, r);
|
|
5620
5645
|
} else
|
|
5621
|
-
return
|
|
5646
|
+
return A({
|
|
5622
5647
|
userAgent: window.navigator.userAgent
|
|
5623
5648
|
}, r);
|
|
5624
5649
|
}
|
|
5625
5650
|
}
|
|
5626
|
-
const
|
|
5651
|
+
const ja = (i) => {
|
|
5627
5652
|
if (typeof i != "object" || i === null)
|
|
5628
5653
|
throw new Error("not an object");
|
|
5629
5654
|
if (!("video" in i))
|
|
@@ -5644,7 +5669,7 @@ const $ = class $ extends Pe {
|
|
|
5644
5669
|
* Picture in picture
|
|
5645
5670
|
*/
|
|
5646
5671
|
n(this, "pictureInPicture");
|
|
5647
|
-
n(this, "browser",
|
|
5672
|
+
n(this, "browser", On());
|
|
5648
5673
|
n(this, "options");
|
|
5649
5674
|
n(this, "element");
|
|
5650
5675
|
n(this, "playbackSource");
|
|
@@ -5653,14 +5678,14 @@ const $ = class $ extends Pe {
|
|
|
5653
5678
|
n(this, "modules");
|
|
5654
5679
|
n(this, "clientIp");
|
|
5655
5680
|
n(this, "sessionId");
|
|
5656
|
-
n(this, "clientId",
|
|
5681
|
+
n(this, "clientId", hs());
|
|
5657
5682
|
n(this, "_channels", []);
|
|
5658
5683
|
n(this, "createdAt", Date.now());
|
|
5659
5684
|
n(this, "hasCalledConnect", !1);
|
|
5660
5685
|
n(this, "latestEmittedLanguages", []);
|
|
5661
5686
|
n(this, "wakeLock");
|
|
5662
|
-
n(this, "pool", new
|
|
5663
|
-
n(this, "userAgentInformation", new
|
|
5687
|
+
n(this, "pool", new rs($.MAX_POOL_SIZE));
|
|
5688
|
+
n(this, "userAgentInformation", new Wa());
|
|
5664
5689
|
n(this, "encryptedMediaExtensions");
|
|
5665
5690
|
w(this, Qe, 0);
|
|
5666
5691
|
w(this, Y, []);
|
|
@@ -5729,18 +5754,19 @@ const $ = class $ extends Pe {
|
|
|
5729
5754
|
tags: this.options.get("tags"),
|
|
5730
5755
|
ownerSessionId: this.sessionId,
|
|
5731
5756
|
edgeUrl: this.options.get("edgeUrl"),
|
|
5732
|
-
media: this.options.get("media")
|
|
5757
|
+
media: this.options.get("media"),
|
|
5758
|
+
drm: this.options.get("drm")
|
|
5733
5759
|
}));
|
|
5734
5760
|
n(this, "onConnectInfo", (t) => y(this, null, function* () {
|
|
5735
5761
|
var u;
|
|
5736
|
-
this.sessionId =
|
|
5762
|
+
this.sessionId = hs();
|
|
5737
5763
|
const s = this.modules.subscription.getTargetSubscription(), r = t.channels.find((l) => l.channelId === s.channelId);
|
|
5738
5764
|
if (this.emitter.emit("connect info", t), this._channels = t.channels, this.updateTextTracks((u = r == null ? void 0 : r.renditions) != null ? u : []), !this.textTrack && this.options.get("textTrack") && (this.textTrack = this.options.get("textTrack")), yield Promise.all(
|
|
5739
5765
|
t.channels.map((l) => y(this, null, function* () {
|
|
5740
5766
|
l.overrides && this.options.addOverrides(l.channelId, l.overrides), l.renditions = yield this.filterRenditions(l.renditions), this.modules.renditions.setRenditions(l.channelId, l.renditions);
|
|
5741
5767
|
}))
|
|
5742
5768
|
), !r)
|
|
5743
|
-
throw
|
|
5769
|
+
throw Qs("external");
|
|
5744
5770
|
const o = this.options.getOverride(
|
|
5745
5771
|
"sizeBasedResolutionCapEnabled",
|
|
5746
5772
|
this.channelId
|
|
@@ -5811,10 +5837,10 @@ const $ = class $ extends Pe {
|
|
|
5811
5837
|
if (!st(c) || !this.isSupportedVideoCodecProfile(c.codec, c.codecString))
|
|
5812
5838
|
return !1;
|
|
5813
5839
|
if (!this.willUseMediaSource()) {
|
|
5814
|
-
const p = this.options.get("advanced"), E = (l = p.wasmDecodingConstraint.bitRate) != null ? l : Number.MAX_SAFE_INTEGER,
|
|
5815
|
-
return c.bitRate <= E && c.width <=
|
|
5840
|
+
const p = this.options.get("advanced"), E = (l = p.wasmDecodingConstraint.bitRate) != null ? l : Number.MAX_SAFE_INTEGER, U = (m = p.wasmDecodingConstraint.width) != null ? m : Number.MAX_SAFE_INTEGER, N = (g = p.wasmDecodingConstraint.height) != null ? g : Number.MAX_SAFE_INTEGER;
|
|
5841
|
+
return c.bitRate <= E && c.width <= U && c.height <= N;
|
|
5816
5842
|
}
|
|
5817
|
-
const h = yield
|
|
5843
|
+
const h = yield da(c);
|
|
5818
5844
|
if (!h.supported || c.codec == "av1" && !h.smooth && !h.powerEfficient)
|
|
5819
5845
|
return !1;
|
|
5820
5846
|
const u = this.options.getOverride("maxVideoBitRate", this.channelId);
|
|
@@ -5840,10 +5866,10 @@ const $ = class $ extends Pe {
|
|
|
5840
5866
|
$.INITIAL_MAX_BIT_RATE,
|
|
5841
5867
|
s,
|
|
5842
5868
|
this.targetSubscription.audio.bitRate
|
|
5843
|
-
), a = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), c = this.supportedAudioCodecs(), h = t.renditions.filter(nt), u = t.renditions.filter(st), l = c.find((E) => h.find((
|
|
5869
|
+
), a = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), c = this.supportedAudioCodecs(), h = t.renditions.filter(nt), u = t.renditions.filter(st), l = c.find((E) => h.find((U) => U.codec === E) !== void 0), m = a.find((E) => u.find((U) => U.codec === E) !== void 0), g = h.map((E) => E.language);
|
|
5844
5870
|
if (this.logger.debug("supported and selected codecs", { audioCodecs: c, videoCodecs: a, audioCodec: l, videoCodec: m }), m) {
|
|
5845
5871
|
const E = this.options.get("maxSize");
|
|
5846
|
-
this.modules.subscription.setVideoConstraint(
|
|
5872
|
+
this.modules.subscription.setVideoConstraint(A({
|
|
5847
5873
|
codec: m,
|
|
5848
5874
|
bitRate: this.abrEnabled ? r : this.options.get("maxVideoBitRate")
|
|
5849
5875
|
}, E));
|
|
@@ -5892,7 +5918,7 @@ const $ = class $ extends Pe {
|
|
|
5892
5918
|
if (this.willUseMediaSource() && this.element instanceof HTMLMediaElement)
|
|
5893
5919
|
this.emitter.emit("flush buffers"), yield (r = this.modules.mseModule) == null ? void 0 : r.setSourceBuffers(s);
|
|
5894
5920
|
else {
|
|
5895
|
-
const a = yield
|
|
5921
|
+
const a = yield is.create(
|
|
5896
5922
|
this.emitter,
|
|
5897
5923
|
this.logger.createContext("DecoderModule"),
|
|
5898
5924
|
s,
|
|
@@ -5908,7 +5934,7 @@ const $ = class $ extends Pe {
|
|
|
5908
5934
|
*/
|
|
5909
5935
|
n(this, "unload", () => y(this, null, function* () {
|
|
5910
5936
|
var t, s, r;
|
|
5911
|
-
this.logger.debug("Unloading modules..."), yield Promise.all(Object.values(this.modules).map((o) => o == null ? void 0 : o.unload())), (t = this.wakeLock) == null || t.unload(), this.pool = new
|
|
5937
|
+
this.logger.debug("Unloading modules..."), yield Promise.all(Object.values(this.modules).map((o) => o == null ? void 0 : o.unload())), (t = this.wakeLock) == null || t.unload(), this.pool = new rs($.MAX_POOL_SIZE), (r = (s = this.playbackSource).unload) == null || r.call(s), this.element.remove(), this.emitter.reset(), this.encryptedMediaExtensions.unload(), this.reset(), this.logger.debug("Unloaded modules");
|
|
5912
5938
|
}));
|
|
5913
5939
|
/**
|
|
5914
5940
|
* @deprecated since 3.0.0 Use play instead.
|
|
@@ -5934,7 +5960,7 @@ const $ = class $ extends Pe {
|
|
|
5934
5960
|
this.options.get("pauseSupportEnabled") && this.playbackState !== "paused" && (this.playbackSource.pause(), this.hasCalledConnect && this.suspend());
|
|
5935
5961
|
});
|
|
5936
5962
|
n(this, "registerDebugInstance", () => {
|
|
5937
|
-
|
|
5963
|
+
ca(this);
|
|
5938
5964
|
});
|
|
5939
5965
|
/**
|
|
5940
5966
|
*
|
|
@@ -5963,7 +5989,7 @@ const $ = class $ extends Pe {
|
|
|
5963
5989
|
* Use undocumented properties at your own risk.
|
|
5964
5990
|
*/
|
|
5965
5991
|
n(this, "getStatistics", () => Object.values(this.modules).reduce(
|
|
5966
|
-
(t, s) => s && "getStatistics" in s ?
|
|
5992
|
+
(t, s) => s && "getStatistics" in s ? A(A({}, t), s.getStatistics()) : t,
|
|
5967
5993
|
// Safety: We know that the collective statistics from module map will equal Statistic because the Statistics type is inferred from moduleMap
|
|
5968
5994
|
this.getRuntimeInfo()
|
|
5969
5995
|
));
|
|
@@ -5974,9 +6000,9 @@ const $ = class $ extends Pe {
|
|
|
5974
6000
|
});
|
|
5975
6001
|
n(this, "getRuntimeInfo", () => {
|
|
5976
6002
|
const t = this.modules.canvasModule ? this.options.get("iosMediaElementEnabled") : void 0;
|
|
5977
|
-
return
|
|
6003
|
+
return A({
|
|
5978
6004
|
uptime: Date.now() - this.createdAt,
|
|
5979
|
-
version: "4.0.0-
|
|
6005
|
+
version: "4.0.0-92-g740c26fd",
|
|
5980
6006
|
clientId: this.clientId,
|
|
5981
6007
|
sessionId: this.sessionId,
|
|
5982
6008
|
channelId: this.channelId,
|
|
@@ -6008,7 +6034,7 @@ const $ = class $ extends Pe {
|
|
|
6008
6034
|
if (s && t)
|
|
6009
6035
|
return t - s;
|
|
6010
6036
|
});
|
|
6011
|
-
this.options = new
|
|
6037
|
+
this.options = new aa(A(A({}, Gn), Sr(t)));
|
|
6012
6038
|
const s = ["localhost", "127.0.0.1"];
|
|
6013
6039
|
t.telemetryEnabled === void 0 && s.includes(location.hostname) && this.options.set("telemetryEnabled", !1);
|
|
6014
6040
|
const r = {
|
|
@@ -6022,47 +6048,47 @@ const $ = class $ extends Pe {
|
|
|
6022
6048
|
width: this.options.get("maxSize").width,
|
|
6023
6049
|
height: this.options.get("maxSize").height
|
|
6024
6050
|
}
|
|
6025
|
-
}, o =
|
|
6051
|
+
}, o = Nt.get();
|
|
6026
6052
|
o.setLevel(this.options.get("logLevel")), o.setDebug(!1), this.logger = o;
|
|
6027
|
-
const a =
|
|
6053
|
+
const a = Zi.create(
|
|
6028
6054
|
this.emitter,
|
|
6029
6055
|
this.logger.createContext("PictureInPictureModule")
|
|
6030
|
-
), c =
|
|
6056
|
+
), c = q.create(), h = Fi.create(this.emitter, this.logger.createContext("ConnectionModule"), {
|
|
6031
6057
|
reconnectHandler: this.options.get("reconnectHandler"),
|
|
6032
6058
|
options: this.options,
|
|
6033
6059
|
onConnectInfo: this.onConnectInfo
|
|
6034
|
-
}), u =
|
|
6060
|
+
}), u = es.create(
|
|
6035
6061
|
this.logger.createContext("SubscriptionModule"),
|
|
6036
6062
|
this.emitter,
|
|
6037
6063
|
r
|
|
6038
|
-
), l =
|
|
6064
|
+
), l = $i.create(this.emitter, u), m = Ki.create(
|
|
6039
6065
|
this.emitter,
|
|
6040
6066
|
this.logger.createContext("QualityOfServiceModule")
|
|
6041
|
-
), g =
|
|
6067
|
+
), g = Ji.create(
|
|
6042
6068
|
this.emitter,
|
|
6043
6069
|
this.logger.createContext("PlaybackModule"),
|
|
6044
6070
|
this,
|
|
6045
6071
|
this.options.get("minBufferTime")
|
|
6046
6072
|
);
|
|
6047
|
-
this.encryptedMediaExtensions = new
|
|
6073
|
+
this.encryptedMediaExtensions = new ws(
|
|
6048
6074
|
this.emitter,
|
|
6049
6075
|
this.logger.createContext("EncryptedMediaExtensions"),
|
|
6050
6076
|
(xe = t.drm) == null ? void 0 : xe.headers,
|
|
6051
6077
|
(Ue = t.drm) == null ? void 0 : Ue.queryParams
|
|
6052
6078
|
);
|
|
6053
|
-
const p =
|
|
6054
|
-
let
|
|
6079
|
+
const p = Vi.create(this.emitter), E = this.options.get("poster"), U = E === !0 ? this.getThumbnailUrl() : E || void 0;
|
|
6080
|
+
let N, G, M;
|
|
6055
6081
|
if (this.willUseMediaSource()) {
|
|
6056
|
-
const
|
|
6082
|
+
const f = new Mi({
|
|
6057
6083
|
type: this.options.get("media") == "audio" ? "audio" : "video",
|
|
6058
6084
|
autoplay: !1,
|
|
6059
6085
|
muted: this.options.get("muted") || this.options.get("media") === "video",
|
|
6060
6086
|
logger: this.logger.createContext("MediaElement"),
|
|
6061
|
-
poster:
|
|
6087
|
+
poster: U
|
|
6062
6088
|
});
|
|
6063
|
-
|
|
6089
|
+
f.on("buffer state", (v) => this.emitter.emit("buffer state", v)), f.on("needs user input", (v) => this.emitter.emit("needs user input", v)), f.on("volume state", (v) => this.emit("volume state", v)), f.on("media element state", (v) => this.onMediaElementState(v)), this.element = f.element, this.playbackSource = f, ws.isSupported() && this.encryptedMediaExtensions.attach(f.element), N = qi.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (G = Gt.create(this.logger.createContext("UnpauseModule"), f, p)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: f.element });
|
|
6064
6090
|
} else if (this.browser.platform.iosVersion >= 15 && this.options.get("iosMediaElementEnabled")) {
|
|
6065
|
-
const
|
|
6091
|
+
const f = ji.create(
|
|
6066
6092
|
this.emitter,
|
|
6067
6093
|
this.logger.createContext("ModernCanvasModule"),
|
|
6068
6094
|
this.pool,
|
|
@@ -6070,38 +6096,38 @@ const $ = class $ extends Pe {
|
|
|
6070
6096
|
{
|
|
6071
6097
|
type: this.options.get("media") == "audio" ? "audio" : "video",
|
|
6072
6098
|
muted: this.options.get("muted") || this.options.get("media") === "video",
|
|
6073
|
-
poster:
|
|
6099
|
+
poster: U
|
|
6074
6100
|
}
|
|
6075
|
-
),
|
|
6076
|
-
this.element =
|
|
6101
|
+
), v = f.element();
|
|
6102
|
+
this.element = v.element, this.playbackSource = f, M = f, this.options.get("pictureInPictureEnabled") && this.browser.platform.iosVersion > 15 && this.emitter.emit("add picture in picture listener", { element: this.element }), this.options.get("pauseSupportEnabled") || (G = Gt.create(this.logger.createContext("UnpauseModule"), v, p));
|
|
6077
6103
|
} else {
|
|
6078
|
-
const
|
|
6104
|
+
const f = Wi.create(
|
|
6079
6105
|
this.emitter,
|
|
6080
6106
|
this.logger.createContext("LegacyCanvasModule"),
|
|
6081
6107
|
this.pool,
|
|
6082
6108
|
this,
|
|
6083
6109
|
this.options.get("muted") || this.options.get("media") === "video"
|
|
6084
6110
|
);
|
|
6085
|
-
this.element =
|
|
6111
|
+
this.element = f.element(), this.playbackSource = f, M = f, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new ia());
|
|
6086
6112
|
}
|
|
6087
|
-
this.emitter.on("channel reset", this.resetModules), this.emitter.on("no data timeout", this.resetModules), this.emitter.on("media element state", (
|
|
6088
|
-
this.logger.info("new cap set", { cap:
|
|
6113
|
+
this.emitter.on("channel reset", this.resetModules), this.emitter.on("no data timeout", this.resetModules), this.emitter.on("media element state", (f) => this.onMediaElementState(f)), this.emitter.on("volume state", (f) => this.emit("volume state", f)), this.options.get("pauseSupportEnabled") || this.emitter.on("exit picture in picture", () => c.setTimeout(() => this.play(), 0)), this.emitter.on("constraint cap changed", (f) => {
|
|
6114
|
+
this.logger.info("new cap set", { cap: f }), this.alignSizeAndBitRate(this.targetSubscription);
|
|
6089
6115
|
}), this.pictureInPicture = {
|
|
6090
6116
|
enter: () => a.requestPictureInPicture(),
|
|
6091
6117
|
exit: () => a.exitPictureInPicture(),
|
|
6092
6118
|
isActive: () => a.isPictureInPictureActive(),
|
|
6093
6119
|
isSupported: () => a.isPictureInPictureSupported()
|
|
6094
|
-
}, this.emitter.on("error", (
|
|
6095
|
-
if (
|
|
6120
|
+
}, this.emitter.on("error", (f) => {
|
|
6121
|
+
if (f.type() === "external" && this.emit("error", f), f.isFatal())
|
|
6096
6122
|
return () => void this.unload();
|
|
6097
6123
|
});
|
|
6098
|
-
const _ = this.browser.platform.isIOS && !this.browser.platform.isIpadOS,
|
|
6124
|
+
const _ = this.browser.platform.isIOS && !this.browser.platform.isIpadOS, Z = ts.create(
|
|
6099
6125
|
this.emitter,
|
|
6100
6126
|
this.logger.createContext("SyncModule"),
|
|
6101
6127
|
this.playbackSource,
|
|
6102
6128
|
g,
|
|
6103
6129
|
this.willUseMediaSource() && !_
|
|
6104
|
-
), te = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), me = new URL("/telemetry", te).toString(),
|
|
6130
|
+
), te = (this.options.get("edgeUrl") || this.options.get("url")).replace("wss://", "https://").replace("ws://", "http://").replace("//lb.", "//errors."), me = new URL("/telemetry", te).toString(), Lt = Xt.create(
|
|
6105
6131
|
this.logger.createContext("TelemetryModule"),
|
|
6106
6132
|
this.emitter,
|
|
6107
6133
|
{
|
|
@@ -6113,8 +6139,8 @@ const $ = class $ extends Pe {
|
|
|
6113
6139
|
this
|
|
6114
6140
|
);
|
|
6115
6141
|
this.modules = {
|
|
6116
|
-
telemetry:
|
|
6117
|
-
bufferTime:
|
|
6142
|
+
telemetry: Lt,
|
|
6143
|
+
bufferTime: Di.create(
|
|
6118
6144
|
this.emitter,
|
|
6119
6145
|
this.logger.createContext("BufferTimeModule"),
|
|
6120
6146
|
m,
|
|
@@ -6124,8 +6150,8 @@ const $ = class $ extends Pe {
|
|
|
6124
6150
|
minBufferTime: this.options.get("minBufferTime")
|
|
6125
6151
|
}
|
|
6126
6152
|
),
|
|
6127
|
-
incomingData:
|
|
6128
|
-
adaptivity:
|
|
6153
|
+
incomingData: Hi.create(this.emitter),
|
|
6154
|
+
adaptivity: _i.create(
|
|
6129
6155
|
this.emitter,
|
|
6130
6156
|
this.logger.createContext("AdaptivityModule"),
|
|
6131
6157
|
m,
|
|
@@ -6133,14 +6159,14 @@ const $ = class $ extends Pe {
|
|
|
6133
6159
|
cooldownTime: Math.max(this.options.get("minBufferTime"), 2e3)
|
|
6134
6160
|
}
|
|
6135
6161
|
),
|
|
6136
|
-
constraintCap:
|
|
6162
|
+
constraintCap: Ni.create(
|
|
6137
6163
|
this.emitter,
|
|
6138
6164
|
this.element,
|
|
6139
6165
|
l,
|
|
6140
6166
|
this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1
|
|
6141
6167
|
),
|
|
6142
|
-
event:
|
|
6143
|
-
sync:
|
|
6168
|
+
event: zi.create(this.emitter, this.logger.createContext("EventModule"), Z),
|
|
6169
|
+
sync: Z,
|
|
6144
6170
|
documentState: p,
|
|
6145
6171
|
connection: h,
|
|
6146
6172
|
playback: g,
|
|
@@ -6149,70 +6175,70 @@ const $ = class $ extends Pe {
|
|
|
6149
6175
|
subscription: u,
|
|
6150
6176
|
renditions: l,
|
|
6151
6177
|
qualityOfService: m,
|
|
6152
|
-
mseModule:
|
|
6178
|
+
mseModule: N,
|
|
6153
6179
|
unpause: G,
|
|
6154
|
-
canvasModule:
|
|
6155
|
-
}, this.modules.adaptivity.isEnabled = this.options.get("abrEnabled"), this.emitter.on("page active", (
|
|
6156
|
-
var
|
|
6157
|
-
|
|
6158
|
-
const
|
|
6159
|
-
this.connectionState === "connected" &&
|
|
6180
|
+
canvasModule: M
|
|
6181
|
+
}, this.modules.adaptivity.isEnabled = this.options.get("abrEnabled"), this.emitter.on("page active", (f) => {
|
|
6182
|
+
var v;
|
|
6183
|
+
f && typeof this.disconnectTimeout == "number" && (this.modules.timer.clearInterval(this.disconnectTimeout), this.disconnectTimeout = void 0), f ? this.playbackSource.isPaused || (this.logger.debug("Unsuspending"), this.unsuspend()) : (this.logger.debug("Suspending"), this.suspend(), this.modules.decoder ? this.options.get("iosBackgroundPlayEnabled") ? (this.modules.decoder.unsuspend(), (v = this.modules.canvasModule) == null || v.unsuspend()) : this.modules.connection.disconnect() : (this.disconnectTimeout && this.modules.timer.clearInterval(this.disconnectTimeout), this.disconnectTimeout = this.modules.timer.setInterval(() => {
|
|
6184
|
+
const x = this.playbackState === "paused" || this.muted;
|
|
6185
|
+
this.connectionState === "connected" && x && (this.emitter.emit("flush buffers"), this.modules.connection.disconnect("Page inactive timeout"));
|
|
6160
6186
|
}, $.DISCONNECT_TIMEOUT)));
|
|
6161
6187
|
});
|
|
6162
|
-
let
|
|
6188
|
+
let fe;
|
|
6163
6189
|
this.emitter.on("context switch complete", () => {
|
|
6164
|
-
|
|
6165
|
-
window.clearTimeout(
|
|
6190
|
+
fe || (fe = window.setTimeout(() => {
|
|
6191
|
+
window.clearTimeout(fe), fe = void 0, this.emit("context switch", "completed"), this.emitLanguagesIfChanged();
|
|
6166
6192
|
}, this.targetBufferTime));
|
|
6167
|
-
}), this.emitter.on("context switch started", () => this.emit("context switch", "started")), this.emitter.on("needs user input", (
|
|
6168
|
-
switch (
|
|
6193
|
+
}), this.emitter.on("context switch started", () => this.emit("context switch", "started")), this.emitter.on("needs user input", (f) => this.emit("needs user input", f)), this.emitter.on("event", (f) => {
|
|
6194
|
+
switch (f.type) {
|
|
6169
6195
|
case "metadata":
|
|
6170
|
-
this.emit("metadata",
|
|
6196
|
+
this.emit("metadata", f);
|
|
6171
6197
|
break;
|
|
6172
6198
|
case "channel switch":
|
|
6173
|
-
this.emit("channel switch", { channelId:
|
|
6199
|
+
this.emit("channel switch", { channelId: f.channelId });
|
|
6174
6200
|
break;
|
|
6175
6201
|
case "language switch":
|
|
6176
|
-
this.emit("language switch", { language:
|
|
6202
|
+
this.emit("language switch", { language: f.language });
|
|
6177
6203
|
break;
|
|
6178
6204
|
}
|
|
6179
|
-
}), this.emitter.on("buffer state event", this.onBufferEvent), this.emitter.on("playback state", (
|
|
6180
|
-
|
|
6181
|
-
}), this.emitter.on("connection state", (
|
|
6182
|
-
this.emit("connection state",
|
|
6205
|
+
}), this.emitter.on("buffer state event", this.onBufferEvent), this.emitter.on("playback state", (f) => this.emit("playback state", f)), this.emitter.on("rendition level changed", ({ to: f }) => {
|
|
6206
|
+
f && this.emit("rendition level", f);
|
|
6207
|
+
}), this.emitter.on("connection state", (f) => {
|
|
6208
|
+
this.emit("connection state", f);
|
|
6183
6209
|
}), this.emitter.on("recovered from media error", () => {
|
|
6184
6210
|
this.modules.adaptivity.reset(this.targetBufferTime * 2);
|
|
6185
|
-
}), this.emitter.once("connect info", (
|
|
6186
|
-
var
|
|
6187
|
-
const
|
|
6188
|
-
|
|
6211
|
+
}), this.emitter.once("connect info", (f) => {
|
|
6212
|
+
var P, B, C;
|
|
6213
|
+
const x = ((B = (P = f.telemetry) == null ? void 0 : P.probability) != null ? B : 1) >= Math.random();
|
|
6214
|
+
f.telemetry && ((C = this.modules.telemetry) == null || C.unload(), this.modules.telemetry = Xt.create(
|
|
6189
6215
|
this.logger.createContext("TelemetryModule"),
|
|
6190
6216
|
this.emitter,
|
|
6191
|
-
|
|
6192
|
-
enabled: this.options.get("telemetryEnabled") &&
|
|
6217
|
+
L(A({}, f.telemetry), {
|
|
6218
|
+
enabled: this.options.get("telemetryEnabled") && x
|
|
6193
6219
|
}),
|
|
6194
6220
|
this
|
|
6195
6221
|
), this.modules.telemetry.load());
|
|
6196
|
-
}), this.emitter.on("adapt level", (
|
|
6222
|
+
}), this.emitter.on("adapt level", (f) => {
|
|
6197
6223
|
var ie, O, Q, re, se;
|
|
6198
|
-
this.logger.debug("adapt level", { direction:
|
|
6199
|
-
const
|
|
6200
|
-
let C =
|
|
6201
|
-
switch (
|
|
6224
|
+
this.logger.debug("adapt level", { direction: f });
|
|
6225
|
+
const v = this.modules.renditions.getRenditionLevels(), x = this.modules.renditions.getRenditionLevel(), P = v.findIndex((V) => V === x), B = v.length - 1;
|
|
6226
|
+
let C = P;
|
|
6227
|
+
switch (f) {
|
|
6202
6228
|
case "upgrade":
|
|
6203
6229
|
{
|
|
6204
|
-
const
|
|
6205
|
-
oe &&
|
|
6230
|
+
const V = Math.min(P + 1, B), oe = v[V], An = (ie = this.modules.connection.estimatedBandwidth) != null ? ie : ke(), gn = ((Q = (O = oe == null ? void 0 : oe.audio) == null ? void 0 : O.bitRate) != null ? Q : 0) + ((se = (re = oe == null ? void 0 : oe.video) == null ? void 0 : re.bitRate) != null ? se : 0), pn = An * 2 > gn;
|
|
6231
|
+
oe && pn && this.modules.adaptivity.isQoSOk(oe) && (C = V);
|
|
6206
6232
|
}
|
|
6207
6233
|
break;
|
|
6208
6234
|
case "downgrade":
|
|
6209
|
-
C = Math.max(
|
|
6235
|
+
C = Math.max(P - 1, 0);
|
|
6210
6236
|
break;
|
|
6211
6237
|
case "double downgrade":
|
|
6212
|
-
C = Math.max(
|
|
6238
|
+
C = Math.max(P - 2, 0);
|
|
6213
6239
|
break;
|
|
6214
6240
|
case "reconnect":
|
|
6215
|
-
if (
|
|
6241
|
+
if (P === 0 || this.modules.qualityOfService.timeSpentBufferingLast(6e3) > 5e3) {
|
|
6216
6242
|
if (!this.modules.connection.lastConnectionTime || Date.now() - this.modules.connection.lastConnectionTime < this.modules.qualityOfService.fatalQosGraceTime() || this.modules.connection.getState() !== "connected")
|
|
6217
6243
|
return;
|
|
6218
6244
|
this.modules.qualityOfService.incrementFatalQosCount(), this.logger.info("Reconnecting due to poor qos"), this.modules.connection.reconnect("Fatal QOS"), this.emitter.emit("adapted level");
|
|
@@ -6220,44 +6246,44 @@ const $ = class $ extends Pe {
|
|
|
6220
6246
|
} else
|
|
6221
6247
|
C = 0;
|
|
6222
6248
|
}
|
|
6223
|
-
if (C ===
|
|
6249
|
+
if (C === P)
|
|
6224
6250
|
return;
|
|
6225
|
-
const D =
|
|
6226
|
-
this.alignSizeAndBitRate(
|
|
6227
|
-
video:
|
|
6228
|
-
audio:
|
|
6251
|
+
const D = v[C];
|
|
6252
|
+
this.alignSizeAndBitRate(L(A({}, this.targetSubscription), {
|
|
6253
|
+
video: A(A({}, this.targetSubscription.video), D == null ? void 0 : D.video),
|
|
6254
|
+
audio: A(A({}, this.targetSubscription.audio), D == null ? void 0 : D.audio)
|
|
6229
6255
|
})), this.emitter.emit("adapted level");
|
|
6230
|
-
}), this.emitter.on("text track data", (
|
|
6231
|
-
const
|
|
6232
|
-
if (
|
|
6233
|
-
if (
|
|
6234
|
-
for (const C of
|
|
6235
|
-
C.startTime -=
|
|
6236
|
-
for (const C of
|
|
6237
|
-
const D = new VTTCue(C.startTime -
|
|
6238
|
-
|
|
6256
|
+
}), this.emitter.on("text track data", (f) => {
|
|
6257
|
+
const v = d(this, Y).find((C) => C.language === f.language), P = this.modules.sync.getTimeshiftOffset() / 1e3, B = P - d(this, Qe);
|
|
6258
|
+
if (S(this, Qe, P), v) {
|
|
6259
|
+
if (v.cues)
|
|
6260
|
+
for (const C of v.cues)
|
|
6261
|
+
C.startTime -= B, C.endTime -= B;
|
|
6262
|
+
for (const C of f.cues) {
|
|
6263
|
+
const D = new VTTCue(C.startTime - P, C.endTime - P, C.text);
|
|
6264
|
+
v.addCue(D);
|
|
6239
6265
|
}
|
|
6240
6266
|
}
|
|
6241
|
-
}), this.emitter.on("received signal", (
|
|
6267
|
+
}), this.emitter.on("received signal", (f) => {
|
|
6242
6268
|
var P;
|
|
6243
|
-
const
|
|
6244
|
-
switch (this.logger.debug("received",
|
|
6269
|
+
const v = f, x = this.modules.subscription.getCurrentSubscription();
|
|
6270
|
+
switch (this.logger.debug("received", A({}, v)), v.type) {
|
|
6245
6271
|
case "client ip":
|
|
6246
|
-
this.clientIp =
|
|
6272
|
+
this.clientIp = v.ip;
|
|
6247
6273
|
break;
|
|
6248
6274
|
case "renditions":
|
|
6249
|
-
this.updateTextTracks(
|
|
6275
|
+
this.updateTextTracks(v.renditions), S(this, Xe, this.filterRenditions(v.renditions).then((B) => {
|
|
6250
6276
|
this.emitter.emit("renditions", {
|
|
6251
6277
|
renditions: B,
|
|
6252
6278
|
channelId: this.currentSubscription.channelId
|
|
6253
6279
|
}), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged();
|
|
6254
6280
|
}).finally(() => {
|
|
6255
|
-
|
|
6281
|
+
S(this, Xe, void 0);
|
|
6256
6282
|
}));
|
|
6257
6283
|
break;
|
|
6258
6284
|
case "subscription changed":
|
|
6259
6285
|
try {
|
|
6260
|
-
|
|
6286
|
+
ja(v.subscription);
|
|
6261
6287
|
} catch (B) {
|
|
6262
6288
|
this.emitter.emit(
|
|
6263
6289
|
"error",
|
|
@@ -6269,28 +6295,31 @@ const $ = class $ extends Pe {
|
|
|
6269
6295
|
);
|
|
6270
6296
|
}
|
|
6271
6297
|
this.emitter.emit("subscription changed", {
|
|
6272
|
-
|
|
6298
|
+
reset: v.reset,
|
|
6299
|
+
to: v.subscription,
|
|
6273
6300
|
from: this.modules.subscription.getCurrentSubscription()
|
|
6274
|
-
}), this.modules.sync.timeshiftOnAudio = !((P =
|
|
6301
|
+
}), v.reset && x.channelId !== v.subscription.channelId && (this.emit("error", As(v.subscription.channelId)), this.emit("channel switch failed", { channelId: x.channelId })), this.modules.sync.timeshiftOnAudio = !((P = v.subscription.video) != null && P.codec), this.modules.adaptivity.reset();
|
|
6275
6302
|
break;
|
|
6276
6303
|
case "timing info":
|
|
6277
|
-
this.modules.sync.updateChannelSyncInfo(
|
|
6304
|
+
this.modules.sync.updateChannelSyncInfo(v.timingInfo.channelId, v.timingInfo), this.emit("server wallclock time", v.timingInfo.wallclockTime);
|
|
6278
6305
|
break;
|
|
6279
6306
|
}
|
|
6280
|
-
}), this.emitter.on("
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6307
|
+
}), this.emitter.on("channel switch timeout", (f) => {
|
|
6308
|
+
this.emit("error", As(f)), this.emit("channel switch failed", { channelId: this.currentSubscription.channelId });
|
|
6309
|
+
}), this.emitter.on("received data", (f) => {
|
|
6310
|
+
const v = this.modules.subscription.getCurrentSubscription(), x = ea(f);
|
|
6311
|
+
if (!v) {
|
|
6312
|
+
this.logger.warn("Received unwanted message", A({}, x));
|
|
6284
6313
|
return;
|
|
6285
6314
|
}
|
|
6286
|
-
Mt(
|
|
6287
|
-
}), this.emitter.on("received moq data", (
|
|
6315
|
+
Mt(L(A({}, x), { channelId: v.channelId }));
|
|
6316
|
+
}), this.emitter.on("received moq data", (f) => {
|
|
6288
6317
|
var C, D, ie;
|
|
6289
|
-
const
|
|
6290
|
-
if (this.modules.incomingData.add(
|
|
6318
|
+
const v = f.payload.mediaType(), x = f.channelId, P = f.renditionId, B = this.modules.sync.processFragment(x, f.payload);
|
|
6319
|
+
if (this.modules.incomingData.add(v, f.payload.rawBytes().byteLength), B.fragment().emsgs.forEach((O) => {
|
|
6291
6320
|
if (!O.presentationTime)
|
|
6292
6321
|
return;
|
|
6293
|
-
const Q =
|
|
6322
|
+
const Q = Vr(O.data);
|
|
6294
6323
|
Q && this.modules.event.addEvent({
|
|
6295
6324
|
id: O.id,
|
|
6296
6325
|
timestamp: O.presentationTime / O.timescale * 1e3 - this.modules.sync.getTimeshiftOffset(),
|
|
@@ -6298,92 +6327,92 @@ const $ = class $ extends Pe {
|
|
|
6298
6327
|
type: "metadata"
|
|
6299
6328
|
});
|
|
6300
6329
|
}), this.modules.decoder) {
|
|
6301
|
-
const O = (C =
|
|
6330
|
+
const O = (C = B.header().init().moov.traks[0]) == null ? void 0 : C.mdia.minf.stbl.stsd, Q = (D = O == null ? void 0 : O.avc1) == null ? void 0 : D.avcC.bytes, re = (ie = O == null ? void 0 : O.codec) != null ? ie : "h264";
|
|
6302
6331
|
if (Q) {
|
|
6303
6332
|
const se = Q.buffer.slice(Q.byteOffset, Q.byteOffset + Q.byteLength);
|
|
6304
|
-
if (
|
|
6333
|
+
if (v === "text")
|
|
6305
6334
|
throw new Error("Subtitles are not supported");
|
|
6306
6335
|
this.emitter.emit("init segment", {
|
|
6307
6336
|
initSegment: {
|
|
6308
|
-
channelId:
|
|
6309
|
-
renditionId:
|
|
6337
|
+
channelId: x,
|
|
6338
|
+
renditionId: P,
|
|
6310
6339
|
data: se,
|
|
6311
6340
|
timescale: 1e3,
|
|
6312
|
-
type:
|
|
6341
|
+
type: v,
|
|
6313
6342
|
codec: re
|
|
6314
6343
|
},
|
|
6315
|
-
mimeType:
|
|
6344
|
+
mimeType: v
|
|
6316
6345
|
// mediaType !== mimeType - but the sw decoder doesn't care
|
|
6317
6346
|
});
|
|
6318
6347
|
}
|
|
6319
|
-
for (let se = 0; se <
|
|
6320
|
-
const
|
|
6321
|
-
|
|
6322
|
-
renditionId:
|
|
6323
|
-
channelId:
|
|
6324
|
-
data:
|
|
6348
|
+
for (let se = 0; se < B.samplesCount(); se++) {
|
|
6349
|
+
const V = B.sample(se);
|
|
6350
|
+
V && this.emitter.emit("coded sample", L(A({}, V), {
|
|
6351
|
+
renditionId: P,
|
|
6352
|
+
channelId: x,
|
|
6353
|
+
data: V.data.buffer.slice(V.data.byteOffset, V.data.byteOffset + V.data.byteLength)
|
|
6325
6354
|
}));
|
|
6326
6355
|
}
|
|
6327
6356
|
} else
|
|
6328
|
-
this.emitter.emit("fragment", { fragment:
|
|
6357
|
+
this.emitter.emit("fragment", { fragment: B, channelId: x });
|
|
6329
6358
|
});
|
|
6330
6359
|
const lt = this.options.get("container");
|
|
6331
6360
|
lt && this.attach(lt), this.logger.info("Created Vindral instance", { options: this.options });
|
|
6332
|
-
const Mt = (
|
|
6333
|
-
const
|
|
6361
|
+
const Mt = (f) => y(this, null, function* () {
|
|
6362
|
+
const v = f.channelId;
|
|
6334
6363
|
d(this, Xe) && (yield d(this, Xe));
|
|
6335
|
-
const
|
|
6336
|
-
if (!
|
|
6337
|
-
if (
|
|
6338
|
-
const
|
|
6339
|
-
if (
|
|
6340
|
-
const D =
|
|
6364
|
+
const x = this.modules.renditions.getRendition(f.renditionId, v);
|
|
6365
|
+
if (!Yo(f.flags)) {
|
|
6366
|
+
if (Ko(f.flags)) {
|
|
6367
|
+
const B = new TextDecoder().decode(f.payload), C = this.modules.sync.getTimeshiftOffset();
|
|
6368
|
+
if (f.renditionId !== 0) {
|
|
6369
|
+
const D = Bn(B);
|
|
6341
6370
|
if (D && D.language !== void 0) {
|
|
6342
|
-
const O = new
|
|
6343
|
-
if (
|
|
6371
|
+
const O = new na().parse(D.content || ""), Q = C / 1e3, re = d(this, Y).find((V) => V.language === D.language), se = Q - d(this, Qe);
|
|
6372
|
+
if (S(this, Qe, Q), re) {
|
|
6344
6373
|
if (re.cues)
|
|
6345
|
-
for (const
|
|
6346
|
-
|
|
6347
|
-
for (const
|
|
6348
|
-
const oe = new VTTCue(
|
|
6374
|
+
for (const V of re.cues)
|
|
6375
|
+
V.startTime -= se, V.endTime -= se;
|
|
6376
|
+
for (const V of O) {
|
|
6377
|
+
const oe = new VTTCue(V.startTime - Q, V.endTime - Q, V.text);
|
|
6349
6378
|
re.addCue(oe);
|
|
6350
6379
|
}
|
|
6351
6380
|
}
|
|
6352
6381
|
}
|
|
6353
6382
|
} else
|
|
6354
6383
|
this.modules.event.addEvent({
|
|
6355
|
-
timestamp:
|
|
6356
|
-
content:
|
|
6384
|
+
timestamp: f.timestamp / f.timescale * 1e3 - this.modules.sync.getTimeshiftOffset(),
|
|
6385
|
+
content: B,
|
|
6357
6386
|
type: "metadata"
|
|
6358
6387
|
});
|
|
6359
|
-
} else if (
|
|
6360
|
-
const
|
|
6361
|
-
if (
|
|
6388
|
+
} else if (x != null && x.codec) {
|
|
6389
|
+
const P = Rn(x.codec);
|
|
6390
|
+
if (P === "text")
|
|
6362
6391
|
throw new Error("Subtitles are not supported");
|
|
6363
|
-
if (this.modules.incomingData.add(
|
|
6364
|
-
const
|
|
6365
|
-
type:
|
|
6366
|
-
data:
|
|
6367
|
-
codec:
|
|
6368
|
-
},
|
|
6369
|
-
channelId:
|
|
6370
|
-
}), C =
|
|
6371
|
-
C && this.sizes.set(
|
|
6372
|
-
const D = $e({ codec:
|
|
6373
|
-
this.emitter.emit("init segment", { initSegment:
|
|
6392
|
+
if (this.modules.incomingData.add(P, f.payload.byteLength), Jo(f.flags)) {
|
|
6393
|
+
const B = L(A({
|
|
6394
|
+
type: P,
|
|
6395
|
+
data: f.payload,
|
|
6396
|
+
codec: x.codec
|
|
6397
|
+
}, f), {
|
|
6398
|
+
channelId: v
|
|
6399
|
+
}), C = Xo(B.codec, B.payload);
|
|
6400
|
+
C && this.sizes.set(B.renditionId, C);
|
|
6401
|
+
const D = $e({ codec: x.codec, codecString: x.codecString });
|
|
6402
|
+
this.emitter.emit("init segment", { initSegment: B, mimeType: D }), this.emit("initialized media");
|
|
6374
6403
|
} else {
|
|
6375
|
-
const
|
|
6376
|
-
let C = this.sampleProcessingSesssions.get(
|
|
6404
|
+
const B = Ga(f, x, this.sizes.get(f.renditionId));
|
|
6405
|
+
let C = this.sampleProcessingSesssions.get(P);
|
|
6377
6406
|
if (!C)
|
|
6378
|
-
C =
|
|
6379
|
-
this.modules.sync.processSample(
|
|
6380
|
-
), this.sampleProcessingSesssions.set(
|
|
6407
|
+
C = Xa(
|
|
6408
|
+
this.modules.sync.processSample(B)
|
|
6409
|
+
), this.sampleProcessingSesssions.set(P, C);
|
|
6381
6410
|
else {
|
|
6382
6411
|
const D = C(
|
|
6383
|
-
this.modules.sync.processSample(
|
|
6384
|
-
this.isSwitchingRenditionLevel &&
|
|
6412
|
+
this.modules.sync.processSample(B),
|
|
6413
|
+
this.isSwitchingRenditionLevel && B.type === "video"
|
|
6385
6414
|
);
|
|
6386
|
-
let ie =
|
|
6415
|
+
let ie = B;
|
|
6387
6416
|
D.forEach((O) => {
|
|
6388
6417
|
this.modules.event.extractEvent(O, ie), this.emitter.emit("coded sample", O), ie = O;
|
|
6389
6418
|
});
|
|
@@ -6392,7 +6421,7 @@ const $ = class $ extends Pe {
|
|
|
6392
6421
|
}
|
|
6393
6422
|
}
|
|
6394
6423
|
});
|
|
6395
|
-
this.options.get("maxVideoBitRate") !== Number.MAX_SAFE_INTEGER && (this.maxVideoBitRate = this.options.get("maxVideoBitRate")), this.options.get("maxAudioBitRate") !== Number.MAX_SAFE_INTEGER && (this.maxAudioBitRate = this.options.get("maxAudioBitRate")), je(this.options.get("maxSize"),
|
|
6424
|
+
this.options.get("maxVideoBitRate") !== Number.MAX_SAFE_INTEGER && (this.maxVideoBitRate = this.options.get("maxVideoBitRate")), this.options.get("maxAudioBitRate") !== Number.MAX_SAFE_INTEGER && (this.maxAudioBitRate = this.options.get("maxAudioBitRate")), je(this.options.get("maxSize"), Vt()) || (this.maxSize = this.options.get("maxSize")), this.options.get("burstEnabled") && u.enableBurst(this.targetBufferTime);
|
|
6396
6425
|
}
|
|
6397
6426
|
// TODO: volym blir nog fuckad när vi startar och mutear - måste testa om volume ändras när muted ändras
|
|
6398
6427
|
/**
|
|
@@ -6406,6 +6435,9 @@ const $ = class $ extends Pe {
|
|
|
6406
6435
|
* [Read more about it on Apple docs](https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html)
|
|
6407
6436
|
* for iOS-Specific Considerations. The following section is the important part:
|
|
6408
6437
|
* On iOS devices, the audio level is always under the user's physical control. The volume property is not settable in JavaScript. Reading the volume property always returns 1.
|
|
6438
|
+
*
|
|
6439
|
+
* @param volume The volume to set. A floating point value between 0-1.
|
|
6440
|
+
*
|
|
6409
6441
|
*/
|
|
6410
6442
|
set volume(t) {
|
|
6411
6443
|
this.playbackSource.volume = t;
|
|
@@ -6432,7 +6464,7 @@ const $ = class $ extends Pe {
|
|
|
6432
6464
|
return this.playbackSource.muted;
|
|
6433
6465
|
}
|
|
6434
6466
|
/**
|
|
6435
|
-
*
|
|
6467
|
+
* Which media type is currently being played
|
|
6436
6468
|
*/
|
|
6437
6469
|
get media() {
|
|
6438
6470
|
return this.options.get("media");
|
|
@@ -6626,11 +6658,11 @@ const $ = class $ extends Pe {
|
|
|
6626
6658
|
}), this.alignSizeAndBitRate(this.targetSubscription);
|
|
6627
6659
|
}
|
|
6628
6660
|
/**
|
|
6629
|
-
* Max size that will be
|
|
6661
|
+
* Max size that will be subscribed to
|
|
6630
6662
|
*/
|
|
6631
6663
|
get maxSize() {
|
|
6632
6664
|
var r, o;
|
|
6633
|
-
const { width: t, height: s } = (o = (r = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : r.video) != null ? o :
|
|
6665
|
+
const { width: t, height: s } = (o = (r = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : r.video) != null ? o : Vt();
|
|
6634
6666
|
return { width: t, height: s };
|
|
6635
6667
|
}
|
|
6636
6668
|
/**
|
|
@@ -6768,9 +6800,9 @@ const $ = class $ extends Pe {
|
|
|
6768
6800
|
* Aligns size and bitrate to match a rendition level correctly
|
|
6769
6801
|
*/
|
|
6770
6802
|
alignSizeAndBitRate(t) {
|
|
6771
|
-
const s = this.modules.constraintCap.constrainSubscription(
|
|
6772
|
-
video:
|
|
6773
|
-
audio:
|
|
6803
|
+
const s = this.modules.constraintCap.constrainSubscription(L(A({}, t), {
|
|
6804
|
+
video: A({}, t.video),
|
|
6805
|
+
audio: A({}, t.audio)
|
|
6774
6806
|
})), r = this.modules.constraintCap.getUserSpecifiedCap();
|
|
6775
6807
|
!this.abrEnabled && r && (s.audio.bitRate = r.audio.bitRate, s.video.bitRate = r.video.bitRate, s.video.width = r.video.width, s.video.height = r.video.height);
|
|
6776
6808
|
const o = this.modules.renditions.getRenditionLevel(s);
|
|
@@ -6796,34 +6828,34 @@ const $ = class $ extends Pe {
|
|
|
6796
6828
|
}
|
|
6797
6829
|
};
|
|
6798
6830
|
Qe = new WeakMap(), Y = new WeakMap(), Xe = new WeakMap(), n($, "MAX_POOL_SIZE", 10), n($, "INITIAL_MAX_BIT_RATE", 2.5 * 1e3 * 1e3), n($, "DISCONNECT_TIMEOUT", 15 * 1e3), n($, "REMOVE_CUE_THRESHOLD", 1e3 * 10);
|
|
6799
|
-
let
|
|
6831
|
+
let Fs = $;
|
|
6800
6832
|
export {
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6833
|
+
ar as A,
|
|
6834
|
+
os as B,
|
|
6835
|
+
Wn as C,
|
|
6836
|
+
St as D,
|
|
6837
|
+
J as F,
|
|
6838
|
+
Kn as I,
|
|
6839
|
+
Nt as L,
|
|
6840
|
+
Yn as N,
|
|
6841
|
+
Fs as V,
|
|
6842
|
+
na as W,
|
|
6843
|
+
Ut as a,
|
|
6844
|
+
zs as b,
|
|
6813
6845
|
nt as c,
|
|
6814
|
-
|
|
6846
|
+
hr as d,
|
|
6815
6847
|
st as e,
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6848
|
+
Ka as f,
|
|
6849
|
+
Ya as g,
|
|
6850
|
+
Zn as h,
|
|
6851
|
+
$a as i,
|
|
6852
|
+
qn as j,
|
|
6853
|
+
Jn as k,
|
|
6854
|
+
jn as l,
|
|
6823
6855
|
Ye as m,
|
|
6824
6856
|
le as n,
|
|
6825
|
-
|
|
6857
|
+
ir as o,
|
|
6826
6858
|
T as p,
|
|
6827
|
-
|
|
6828
|
-
|
|
6859
|
+
Hn as t,
|
|
6860
|
+
xi as w
|
|
6829
6861
|
};
|