@vindral/web-sdk 4.3.3-9-g5cf928569 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{o8Rd5BvE.js → BMftV7tq.js} +170 -161
- package/Bskov1am.js +166 -0
- package/{BFPgdE3l.js → C2-H3s2r.js} +1 -1
- package/{CjPLLJi5.js → D7vM_Gpt.js} +1 -0
- package/{rxT_V2W-.js → Dv_XIgKC.js} +1519 -1389
- package/core.d.ts +0 -36
- package/core.js +1 -1
- package/legacy.d.ts +0 -36
- package/legacy.es.js +2397 -2390
- package/legacy.umd.js +22 -22
- package/package.json +1 -1
- package/player.d.ts +36 -2
- package/player.js +3 -3
- package/react.d.ts +34 -2
- package/vindral-player-component.js +2 -2
- package/CLJilV9Y.js +0 -166
|
@@ -681,7 +681,16 @@ var A = class {
|
|
|
681
681
|
return typeof n == "object" && t.forEach((e) => {
|
|
682
682
|
delete n[e];
|
|
683
683
|
}), n;
|
|
684
|
-
}
|
|
684
|
+
};
|
|
685
|
+
//#endregion
|
|
686
|
+
//#region ../../libs/utils/src/subtitleFontSize.ts
|
|
687
|
+
function sn(e, t, n) {
|
|
688
|
+
let r = t * .05, i = e * .035, a = Math.max(Math.round(Math.min(r, i)), 16);
|
|
689
|
+
return `${(n == null ? void 0 : n.max) == null ? a : Math.min(a, n.max)}px`;
|
|
690
|
+
}
|
|
691
|
+
//#endregion
|
|
692
|
+
//#region ../../libs/utils/src/Timers.ts
|
|
693
|
+
var cn, j = class {
|
|
685
694
|
constructor() {
|
|
686
695
|
e(this, "pendingTimeouts", /* @__PURE__ */ new Set()), e(this, "pendingIntervals", /* @__PURE__ */ new Set()), e(this, "clearTimeout", (e) => {
|
|
687
696
|
this.pendingTimeouts.delete(e) && window.clearTimeout(e);
|
|
@@ -702,28 +711,28 @@ var A = class {
|
|
|
702
711
|
});
|
|
703
712
|
}
|
|
704
713
|
};
|
|
705
|
-
|
|
714
|
+
cn = j, e(j, "create", () => new cn());
|
|
706
715
|
//#endregion
|
|
707
716
|
//#region ../../libs/utils/src/timeRangesUtils.ts
|
|
708
|
-
var
|
|
717
|
+
var ln = (e, t = performance.now()) => {
|
|
709
718
|
let n = e.length;
|
|
710
719
|
if (n > 0) {
|
|
711
720
|
let r = e[n - 1];
|
|
712
721
|
r.end || (r.end = t);
|
|
713
722
|
}
|
|
714
|
-
},
|
|
715
|
-
|
|
716
|
-
},
|
|
723
|
+
}, un = (e, t = performance.now()) => {
|
|
724
|
+
ln(e, t), e.push({ start: t });
|
|
725
|
+
}, dn = (e) => e.reduce((e, t) => {
|
|
717
726
|
var n;
|
|
718
727
|
return e + (((n = t.end) == null ? performance.now() : n) - t.start);
|
|
719
|
-
}, 0),
|
|
728
|
+
}, 0), fn = (e, t, n = performance.now()) => e.reduce((e, r) => {
|
|
720
729
|
var i;
|
|
721
730
|
let a = Math.max(n - t, r.start), o = (i = r.end) == null ? n : i;
|
|
722
731
|
return Math.max(0, o - a) + e;
|
|
723
732
|
}, 0);
|
|
724
733
|
//#endregion
|
|
725
734
|
//#region ../../libs/utils/src/tryCatch.ts
|
|
726
|
-
function
|
|
735
|
+
function pn(e) {
|
|
727
736
|
try {
|
|
728
737
|
return e();
|
|
729
738
|
} catch (e) {
|
|
@@ -732,7 +741,7 @@ function fn(e) {
|
|
|
732
741
|
}
|
|
733
742
|
//#endregion
|
|
734
743
|
//#region ../../libs/utils/src/userAgentInformation.ts
|
|
735
|
-
var
|
|
744
|
+
var mn = class {
|
|
736
745
|
constructor() {
|
|
737
746
|
var t;
|
|
738
747
|
e(this, "highEntropyValues", void 0), (t = self.navigator.userAgentData) == null || t.getHighEntropyValues([
|
|
@@ -778,7 +787,7 @@ var pn = class {
|
|
|
778
787
|
}, r);
|
|
779
788
|
} else return w({ userAgent: window.navigator.userAgent }, r);
|
|
780
789
|
}
|
|
781
|
-
},
|
|
790
|
+
}, hn = () => {
|
|
782
791
|
let e = [...Array(256).keys()].map((e) => e.toString(16).padStart(2, "0")), t = crypto.getRandomValues(new Uint8Array(16));
|
|
783
792
|
return t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, [...t.entries()].map(([t, n]) => [
|
|
784
793
|
4,
|
|
@@ -786,14 +795,14 @@ var pn = class {
|
|
|
786
795
|
8,
|
|
787
796
|
10
|
|
788
797
|
].includes(t) ? `-${e[n]}` : e[n]).join("");
|
|
789
|
-
},
|
|
798
|
+
}, gn = function() {
|
|
790
799
|
var e = t(function* (e) {
|
|
791
800
|
return new Promise((t) => setTimeout(t, e));
|
|
792
801
|
});
|
|
793
802
|
return function(t) {
|
|
794
803
|
return e.apply(this, arguments);
|
|
795
804
|
};
|
|
796
|
-
}(),
|
|
805
|
+
}(), _n = function() {
|
|
797
806
|
var e = t(function* (e, t = /* @__PURE__ */ Error("Timeout")) {
|
|
798
807
|
return new Promise((n, r) => setTimeout(() => r(t), e));
|
|
799
808
|
});
|
|
@@ -811,7 +820,7 @@ var pn = class {
|
|
|
811
820
|
})();
|
|
812
821
|
//#endregion
|
|
813
822
|
//#region ../../libs/data-types/src/Rendition.ts
|
|
814
|
-
var
|
|
823
|
+
var vn = (e) => "width" in e && typeof e.width == "number", yn = (e) => "sampleRate" in e && typeof e.sampleRate == "number", bn = (e) => {
|
|
815
824
|
switch (e.codec) {
|
|
816
825
|
case "opus": return "audio/mp4; codecs=\"opus\"";
|
|
817
826
|
case "mp3": return "audio/mpeg";
|
|
@@ -821,10 +830,10 @@ var _n = (e) => "width" in e && typeof e.width == "number", vn = (e) => "sampleR
|
|
|
821
830
|
case "h265": return e.codecString ? `video/mp4; codecs="${e.codecString}"` : "video/mp4";
|
|
822
831
|
case "av1": return e.codecString ? `video/mp4; codecs="${e.codecString}"` : "video/mp4";
|
|
823
832
|
}
|
|
824
|
-
},
|
|
833
|
+
}, xn = () => 2 ** 53 - 1, Sn = () => ({
|
|
825
834
|
width: 2 ** 53 - 1,
|
|
826
835
|
height: 2 ** 53 - 1
|
|
827
|
-
}),
|
|
836
|
+
}), Cn = (e) => !(typeof e != "object" || !e || !("type" in e)), wn = {
|
|
828
837
|
sizeBasedResolutionCapEnabled: !0,
|
|
829
838
|
pictureInPictureEnabled: !0,
|
|
830
839
|
abrEnabled: !0,
|
|
@@ -836,9 +845,9 @@ var _n = (e) => "width" in e && typeof e.width == "number", vn = (e) => "sampleR
|
|
|
836
845
|
minBufferTime: 1500,
|
|
837
846
|
maxBufferTime: 1500,
|
|
838
847
|
logLevel: Lt.OFF,
|
|
839
|
-
maxSize:
|
|
840
|
-
maxVideoBitRate:
|
|
841
|
-
maxAudioBitRate:
|
|
848
|
+
maxSize: Sn(),
|
|
849
|
+
maxVideoBitRate: xn(),
|
|
850
|
+
maxAudioBitRate: xn(),
|
|
842
851
|
maxInitialBitRate: 2.5 * 1e3 * 1e3,
|
|
843
852
|
tags: [],
|
|
844
853
|
media: "audio+video",
|
|
@@ -861,45 +870,45 @@ var _n = (e) => "width" in e && typeof e.width == "number", vn = (e) => "sampleR
|
|
|
861
870
|
};
|
|
862
871
|
//#endregion
|
|
863
872
|
//#region ../../libs/web-sdk/src/promiseFinally.ts
|
|
864
|
-
function
|
|
873
|
+
function Tn(e) {
|
|
865
874
|
return typeof e == "function" ? this.then((t) => Promise.resolve(e()).then(() => t), (t) => Promise.resolve(e()).then(() => {
|
|
866
875
|
throw t;
|
|
867
876
|
})) : this.then();
|
|
868
877
|
}
|
|
869
|
-
function
|
|
878
|
+
function En(e = Promise) {
|
|
870
879
|
return typeof e.prototype.finally != "function" && Object.defineProperty(e.prototype, "finally", {
|
|
871
880
|
configurable: !0,
|
|
872
881
|
enumerable: !1,
|
|
873
|
-
value:
|
|
882
|
+
value: Tn,
|
|
874
883
|
writable: !0
|
|
875
884
|
}), e.prototype.finally;
|
|
876
885
|
}
|
|
877
|
-
|
|
886
|
+
En();
|
|
878
887
|
//#endregion
|
|
879
888
|
//#region ../../libs/canvas-renderers/src/applyDefaultCanvasStyles.ts
|
|
880
|
-
var
|
|
889
|
+
var Dn = (e) => {
|
|
881
890
|
e.width = 320, e.height = 180, e.style.width = "100%", e.style.position = "relative", e.style.backgroundColor = "#000";
|
|
882
|
-
},
|
|
891
|
+
}, On = {
|
|
883
892
|
backgroundColor: "rgba(0,0,0,0.6)",
|
|
884
893
|
textPadding: 8,
|
|
885
894
|
fontSize: "28px",
|
|
886
895
|
lineGap: 16
|
|
887
|
-
},
|
|
896
|
+
}, kn = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakMap(), Mn = /* @__PURE__ */ new WeakSet(), Nn = class {
|
|
888
897
|
constructor() {
|
|
889
|
-
C(this,
|
|
890
|
-
let t = x(
|
|
898
|
+
C(this, Mn), y(this, kn, []), y(this, An, document.createElement("canvas")), y(this, M, void 0), y(this, jn, window.devicePixelRatio || 1), e(this, "config", w({}, On));
|
|
899
|
+
let t = x(An, this).getContext("2d", { alpha: !0 });
|
|
891
900
|
if (!t) throw Error("Failed to create 2d context");
|
|
892
|
-
S(M, this, t), b(
|
|
901
|
+
S(M, this, t), b(Mn, this, Fn).call(this);
|
|
893
902
|
}
|
|
894
903
|
get canvas() {
|
|
895
|
-
return x(
|
|
904
|
+
return x(An, this);
|
|
896
905
|
}
|
|
897
906
|
setActiveCues(e) {
|
|
898
|
-
S(
|
|
907
|
+
S(kn, this, e);
|
|
899
908
|
}
|
|
900
909
|
render(e, t = !1) {
|
|
901
|
-
let n = x(
|
|
902
|
-
b(
|
|
910
|
+
let n = x(kn, this).flatMap((t) => t.text.split("\n").flatMap((t) => b(Mn, this, In).call(this, t, e.width)).map((e) => {
|
|
911
|
+
b(Mn, this, Fn).call(this);
|
|
903
912
|
let t = x(M, this).measureText(e);
|
|
904
913
|
return {
|
|
905
914
|
text: e,
|
|
@@ -910,21 +919,21 @@ var En = (e) => {
|
|
|
910
919
|
}
|
|
911
920
|
};
|
|
912
921
|
})), r = Math.max(...n.map((e) => e.size.width)), i = n.reduce((e, { size: t }) => e + t.height, 0) + (n.length - 1) * this.config.lineGap, a = 0;
|
|
913
|
-
b(
|
|
914
|
-
for (let { size: e, text: t } of n) b(
|
|
915
|
-
t && (x(M, this).strokeStyle = "red", x(M, this).strokeRect(0, 0, e.width, x(
|
|
922
|
+
b(Mn, this, Pn).call(this, r, i), x(M, this).clearRect(0, 0, x(An, this).width, x(An, this).height);
|
|
923
|
+
for (let { size: e, text: t } of n) b(Mn, this, Fn).call(this), x(M, this).fillStyle = this.config.backgroundColor, x(M, this).fillRect(0, a, e.width, e.height), b(Mn, this, Fn).call(this), x(M, this).fillText(t, this.config.textPadding, a + this.config.textPadding), a += e.height + this.config.lineGap;
|
|
924
|
+
t && (x(M, this).strokeStyle = "red", x(M, this).strokeRect(0, 0, e.width, x(An, this).height));
|
|
916
925
|
}
|
|
917
926
|
};
|
|
918
|
-
function
|
|
919
|
-
x(
|
|
927
|
+
function Pn(e, t) {
|
|
928
|
+
x(An, this).width = e * x(jn, this), x(An, this).height = t * x(jn, this), x(M, this).setTransform(x(jn, this), 0, 0, x(jn, this), 0, 0), this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`;
|
|
920
929
|
}
|
|
921
|
-
function
|
|
930
|
+
function Fn() {
|
|
922
931
|
x(M, this).fillStyle = "white", x(M, this).textAlign = "left", x(M, this).textBaseline = "top", x(M, this).font = `${this.config.fontSize} sans-serif`;
|
|
923
932
|
}
|
|
924
|
-
function
|
|
933
|
+
function In(e, t) {
|
|
925
934
|
let n = [], r = e.split(" "), i = "";
|
|
926
935
|
for (; r.length > 0;) {
|
|
927
|
-
b(
|
|
936
|
+
b(Mn, this, Fn).call(this);
|
|
928
937
|
let e = 0;
|
|
929
938
|
for (; x(M, this).measureText(i + (i.length > 0 ? " " : "") + r[0]).width + this.config.textPadding * 2 <= t && r.length > 0;) e++, i += (i.length > 0 ? " " : "") + r.shift();
|
|
930
939
|
if (e === 0) {
|
|
@@ -937,10 +946,6 @@ function Fn(e, t) {
|
|
|
937
946
|
}
|
|
938
947
|
//#endregion
|
|
939
948
|
//#region ../../libs/canvas-renderers/src/subtitleLayout.ts
|
|
940
|
-
function In(e, t) {
|
|
941
|
-
let n = t * .05, r = e * .035;
|
|
942
|
-
return `${Math.max(Math.round(Math.min(n, r)), 16)}px`;
|
|
943
|
-
}
|
|
944
949
|
function Ln(e) {
|
|
945
950
|
var t;
|
|
946
951
|
let { subtitleWidth: n, subtitleHeight: r, canvasWidth: i, canvasHeight: a, containerWidth: o, bottomPadding: s } = e, c = (t = e.baseMargin) == null ? 20 : t, l = i / o, u = n * l, d = r * l;
|
|
@@ -975,7 +980,7 @@ var zn = {
|
|
|
975
980
|
}), e(this, "unload", () => {
|
|
976
981
|
this.context = null, this.subtitleRenderer = null, this.hasActiveSubtitles = !1, this.setSize(zn);
|
|
977
982
|
}), e(this, "setActiveCues", (e, t) => {
|
|
978
|
-
this.subtitleRenderer || (this.subtitleRenderer = new
|
|
983
|
+
this.subtitleRenderer || (this.subtitleRenderer = new Nn()), this.subtitleRenderer.config.fontSize = sn(t.width, t.height), this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t), this.hasActiveSubtitles = e.length > 0;
|
|
979
984
|
}), e(this, "render", (e, t = 0) => {
|
|
980
985
|
if (!this.context) return;
|
|
981
986
|
if (!e.videoFrame) {
|
|
@@ -1007,7 +1012,7 @@ var zn = {
|
|
|
1007
1012
|
this.context.drawImage(t, i.x, i.y, i.drawWidth, i.drawHeight);
|
|
1008
1013
|
}), e(this, "setSize", (e) => {
|
|
1009
1014
|
e.width === this.size.width && e.height === this.size.height || (this.size = e, this.canvas.width = e.width, this.canvas.height = e.height, this.context && (this.context.fillStyle = "#000", this.context.fillRect(0, 0, e.width, e.height)));
|
|
1010
|
-
}),
|
|
1015
|
+
}), Dn(this.canvas);
|
|
1011
1016
|
}
|
|
1012
1017
|
}, Vn = "\nprecision mediump float;\nuniform sampler2D texture;\n\nvarying vec2 texture_coordinate;\n\nvoid main() {\n float y = texture2D(texture, texture_coordinate).r;\n float a = texture2D(texture, texture_coordinate).a;\n\n gl_FragColor = vec4(y, y, y, a);\n}\n", Hn = "\n attribute vec2 position;\n varying vec2 texture_coordinate;\n uniform mat4 model;\n\n void main() {\n texture_coordinate = position;\n gl_Position = model * vec4(position, 0.0, 1.0);\n }\n", Un = (e, t) => {
|
|
1013
1018
|
let n = e.getContext("webgl", t);
|
|
@@ -1060,7 +1065,7 @@ var zn = {
|
|
|
1060
1065
|
return r;
|
|
1061
1066
|
}, N = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakMap(), Yn = /* @__PURE__ */ new WeakMap(), Xn = /* @__PURE__ */ new WeakMap(), Zn = /* @__PURE__ */ new WeakMap(), Qn = /* @__PURE__ */ new WeakSet(), $n = /* @__PURE__ */ new WeakMap(), er = class {
|
|
1062
1067
|
constructor(t) {
|
|
1063
|
-
C(this, Qn), y(this, N, void 0), y(this, Jn, void 0), y(this, Yn, void 0), y(this, Xn, void 0), y(this, Zn, void 0), e(this, "subtitleRenderer", new
|
|
1068
|
+
C(this, Qn), y(this, N, void 0), y(this, Jn, void 0), y(this, Yn, void 0), y(this, Xn, void 0), y(this, Zn, void 0), e(this, "subtitleRenderer", new Nn()), y(this, $n, (e, t, n, r) => [
|
|
1064
1069
|
e,
|
|
1065
1070
|
0,
|
|
1066
1071
|
0,
|
|
@@ -1080,7 +1085,7 @@ var zn = {
|
|
|
1080
1085
|
]), S(N, this, t), S(Jn, this, Gn(t)), S(Yn, this, Wn(t, t.FRAGMENT_SHADER, Vn)), S(Xn, this, Wn(t, t.VERTEX_SHADER, Hn)), S(Zn, this, qn(t, x(Xn, this), x(Yn, this)));
|
|
1081
1086
|
}
|
|
1082
1087
|
setActiveCues(e, t) {
|
|
1083
|
-
this.subtitleRenderer.config.fontSize =
|
|
1088
|
+
this.subtitleRenderer.config.fontSize = sn(t.width, t.height), this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t);
|
|
1084
1089
|
}
|
|
1085
1090
|
render(e) {
|
|
1086
1091
|
let t = this.subtitleRenderer.canvas;
|
|
@@ -1199,7 +1204,7 @@ var rr = "\nprecision mediump float;\nuniform sampler2D y_texture;\nuniform samp
|
|
|
1199
1204
|
1,
|
|
1200
1205
|
0,
|
|
1201
1206
|
1
|
|
1202
|
-
]), this.canvas.addEventListener("webglcontextlost", this.onContextLost), this.canvas.addEventListener("webglcontextrestored", this.onContextRestored, !1),
|
|
1207
|
+
]), this.canvas.addEventListener("webglcontextlost", this.onContextLost), this.canvas.addEventListener("webglcontextrestored", this.onContextRestored, !1), Dn(this.canvas);
|
|
1203
1208
|
}
|
|
1204
1209
|
getTextRenderer() {
|
|
1205
1210
|
return this.textRenderer || (this.textRenderer = new er(this.context)), this.textRenderer;
|
|
@@ -3444,10 +3449,10 @@ function us(e) {
|
|
|
3444
3449
|
var ds = (e) => {
|
|
3445
3450
|
let t = window;
|
|
3446
3451
|
t.vindralInstances = t.vindralInstances || {}, t.vindralInstances[e.getStatistics().clientId.substring(0, 8)] = e;
|
|
3447
|
-
}, fs = class extends ge {
|
|
3448
|
-
constructor({ type:
|
|
3449
|
-
var
|
|
3450
|
-
super(),
|
|
3452
|
+
}, fs = class n extends ge {
|
|
3453
|
+
constructor({ type: r, autoplay: i, muted: a, volume: s, logger: c, poster: l }) {
|
|
3454
|
+
var u;
|
|
3455
|
+
super(), u = this, e(this, "element", void 0), e(this, "logger", void 0), e(this, "seekTimes", new v(10)), e(this, "seekStartTime", void 0), e(this, "_totalSeekTime", 0), e(this, "lastPlayableAt", void 0), e(this, "_userProvidedMuted", void 0), e(this, "timers", new j()), e(this, "_userHasProvidedInput", !1), e(this, "_isPaused", !0), e(this, "isActivated", !1), e(this, "dummy", void 0), e(this, "addEventListeners", () => {
|
|
3451
3456
|
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.onWaiting), 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);
|
|
3452
3457
|
}), e(this, "removeEventListeners", () => {
|
|
3453
3458
|
this.element.removeEventListener("stalled", this.onEvent), this.element.removeEventListener("canplay", this.onEvent), this.element.removeEventListener("loadeddata", this.onEvent), this.element.removeEventListener("loadedmetadata", this.onEvent), this.element.removeEventListener("canplaythrough", this.onEvent), this.element.removeEventListener("waiting", this.onWaiting), this.element.removeEventListener("playing", this.onPlayPause), this.element.removeEventListener("pause", this.onPlayPause), this.element.removeEventListener("seeked", this.onSeekEnd), this.element.removeEventListener("seeking", this.onSeekStart), this.element.removeEventListener("volumechange", this.onVolumeChange), this.element.removeEventListener("timeupdate", this.onBufferStateChange), this.element.removeEventListener("progress", this.onBufferStateChange);
|
|
@@ -3459,12 +3464,10 @@ var ds = (e) => {
|
|
|
3459
3464
|
}), e(this, "attach", (e) => {
|
|
3460
3465
|
this.element.remove(), e.appendChild(this.element);
|
|
3461
3466
|
}), e(this, "load", () => {
|
|
3462
|
-
this.timers.setInterval(this.onPlayPause, 500), this.timers.
|
|
3463
|
-
this.timers.setInterval(this.onBufferStateChange, 500);
|
|
3464
|
-
}, 1e4);
|
|
3467
|
+
this.timers.setInterval(this.onPlayPause, 500), this.onBufferStateChange(), this.timers.setInterval(this.onBufferStateChange, 500);
|
|
3465
3468
|
}), e(this, "unload", () => {
|
|
3466
3469
|
this.timers.unload(), this.removeEventListeners();
|
|
3467
|
-
}), e(this, "getPlaybackRate", () => this.element.playbackRate), e(this, "getPlaybackState", () => this.element.readyState >= this.element.HAVE_FUTURE_DATA ? "playing" : "buffering"), e(this, "getMediaElementState", () => this.element.paused ? "paused" : "playing"), e(this, "setPlaybackRate", (e) => void (this.element.playbackRate = e)), e(this, "getBuffer", () => {
|
|
3470
|
+
}), e(this, "getPlaybackRate", () => this.element.playbackRate), e(this, "getPlaybackState", () => this.element.readyState >= this.element.HAVE_FUTURE_DATA || this.element.seeking && this.lastPlayableAt !== void 0 && performance.now() - this.lastPlayableAt < n.SEEK_SETTLE_BUDGET_MS ? "playing" : "buffering"), e(this, "getMediaElementState", () => this.element.paused ? "paused" : "playing"), e(this, "setPlaybackRate", (e) => void (this.element.playbackRate = e)), e(this, "getBuffer", () => {
|
|
3468
3471
|
let e = [], t = this.element.buffered;
|
|
3469
3472
|
if (!t) return [];
|
|
3470
3473
|
for (let n = 0; n < t.length; n++) e.push({
|
|
@@ -3489,16 +3492,16 @@ var ds = (e) => {
|
|
|
3489
3492
|
});
|
|
3490
3493
|
}), e(this, "_play", t(function* () {
|
|
3491
3494
|
try {
|
|
3492
|
-
yield
|
|
3495
|
+
yield u.element.play(), u._userHasProvidedInput = !u.muted || u._userProvidedMuted;
|
|
3493
3496
|
} catch (e) {
|
|
3494
|
-
if (e instanceof Error && e.name === "NotAllowedError") if (
|
|
3497
|
+
if (e instanceof Error && e.name === "NotAllowedError") if (u._userHasProvidedInput = !1, u.element.muted) u.emit("needs user input", {
|
|
3495
3498
|
forAudio: !0,
|
|
3496
3499
|
forVideo: !0
|
|
3497
3500
|
});
|
|
3498
|
-
else return
|
|
3501
|
+
else return u.element.muted = !0, u.emit("needs user input", {
|
|
3499
3502
|
forAudio: !0,
|
|
3500
3503
|
forVideo: !1
|
|
3501
|
-
}),
|
|
3504
|
+
}), u._play();
|
|
3502
3505
|
else throw e;
|
|
3503
3506
|
}
|
|
3504
3507
|
})), e(this, "onEvent", (e) => {
|
|
@@ -3519,7 +3522,7 @@ var ds = (e) => {
|
|
|
3519
3522
|
});
|
|
3520
3523
|
}), e(this, "onPlayPause", () => {
|
|
3521
3524
|
this._isPaused !== this.element.paused && (this._isPaused = this.element.paused, this.logger.info("player pause change", { paused: this.element.paused }), this.emit("media element state", this.getMediaElementState()));
|
|
3522
|
-
}), e(this, "getBufferState", () => ({
|
|
3525
|
+
}), e(this, "getBufferState", () => (this.element.readyState >= this.element.HAVE_FUTURE_DATA && !this.element.seeking && (this.lastPlayableAt = performance.now()), {
|
|
3523
3526
|
isPaused: this.element.paused,
|
|
3524
3527
|
buffered: this.getBuffer(),
|
|
3525
3528
|
currentTime: this.currentTime,
|
|
@@ -3532,8 +3535,8 @@ var ds = (e) => {
|
|
|
3532
3535
|
if (!this.seekStartTime) return;
|
|
3533
3536
|
let e = performance.now() - this.seekStartTime;
|
|
3534
3537
|
this.seekTimes.push(e), this._totalSeekTime += e, this.seekStartTime = void 0;
|
|
3535
|
-
}), this.logger =
|
|
3536
|
-
!this.element || !
|
|
3538
|
+
}), this.logger = c, this._userProvidedMuted = a, this.element = document.createElement(r), this.element instanceof HTMLVideoElement && (this.element.playsInline = !0), this.element.controls = !1, this.element.autoplay = i, this.element.muted = a, s !== void 0 && (this.element.volume = s), this.element.style.display = "block", this.element.style.width = "100%", this.element.disableRemotePlayback = !0, this.element.setAttribute("poster", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAQAAACRI2S5AAAAEElEQVR42mNkIAAYRxWAAQAG9gAKqv6+AwAAAABJRU5ErkJggg=="), this.onPlayPause(), setTimeout(() => {
|
|
3539
|
+
!this.element || !l || this.element.setAttribute("poster", l);
|
|
3537
3540
|
}, 0), this.addEventListeners();
|
|
3538
3541
|
}
|
|
3539
3542
|
get seekTime() {
|
|
@@ -3575,7 +3578,11 @@ var ds = (e) => {
|
|
|
3575
3578
|
get isPaused() {
|
|
3576
3579
|
return this._isPaused;
|
|
3577
3580
|
}
|
|
3578
|
-
}
|
|
3581
|
+
};
|
|
3582
|
+
e(fs, "SEEK_SETTLE_BUDGET_MS", 1e3);
|
|
3583
|
+
//#endregion
|
|
3584
|
+
//#region ../../libs/web-sdk/src/mediaCapabilities.ts
|
|
3585
|
+
var ps = (e) => {
|
|
3579
3586
|
if (!navigator.mediaCapabilities) return Promise.resolve({
|
|
3580
3587
|
smooth: !0,
|
|
3581
3588
|
supported: !0,
|
|
@@ -3584,10 +3591,10 @@ var ds = (e) => {
|
|
|
3584
3591
|
});
|
|
3585
3592
|
if (e.codec === "webvtt") throw Error("WebVTT is not supported");
|
|
3586
3593
|
let t;
|
|
3587
|
-
return t =
|
|
3594
|
+
return t = yn(e) ? {
|
|
3588
3595
|
type: "media-source",
|
|
3589
3596
|
audio: {
|
|
3590
|
-
contentType:
|
|
3597
|
+
contentType: bn(e),
|
|
3591
3598
|
bitrate: e.bitRate,
|
|
3592
3599
|
channels: e.channels.toString(),
|
|
3593
3600
|
samplerate: e.sampleRate
|
|
@@ -3595,7 +3602,7 @@ var ds = (e) => {
|
|
|
3595
3602
|
} : {
|
|
3596
3603
|
type: "media-source",
|
|
3597
3604
|
video: {
|
|
3598
|
-
contentType:
|
|
3605
|
+
contentType: bn(e),
|
|
3599
3606
|
bitrate: e.bitRate,
|
|
3600
3607
|
width: e.width,
|
|
3601
3608
|
height: e.height,
|
|
@@ -3986,7 +3993,7 @@ var vc = /* @__PURE__ */ new WeakMap(), yc = /* @__PURE__ */ new WeakMap(), bc =
|
|
|
3986
3993
|
let n = new Uint8Array(t.data);
|
|
3987
3994
|
n[0] === x(yc, this) && e.enqueue(n.subarray(1));
|
|
3988
3995
|
}
|
|
3989
|
-
}), x(vc, this).addEventListener("error", () => e.error(/* @__PURE__ */ Error("WebSocket error"))), x(vc, this).addEventListener("close", () =>
|
|
3996
|
+
}), x(vc, this).addEventListener("error", () => e.error(/* @__PURE__ */ Error("WebSocket error"))), x(vc, this).addEventListener("close", () => pn(() => e.close()));
|
|
3990
3997
|
}
|
|
3991
3998
|
cancel(e) {
|
|
3992
3999
|
x(vc, this).close(void 0, e);
|
|
@@ -4008,7 +4015,7 @@ var vc = /* @__PURE__ */ new WeakMap(), yc = /* @__PURE__ */ new WeakMap(), bc =
|
|
|
4008
4015
|
]);
|
|
4009
4016
|
}
|
|
4010
4017
|
}
|
|
4011
|
-
}), S(Cc, this, () =>
|
|
4018
|
+
}), S(Cc, this, () => pn(() => e.close())), S(wc, this, () => e.error(/* @__PURE__ */ Error("WebSocket error"))), x(xc, this).addEventListener("message", x(Sc, this)), x(xc, this).addEventListener("error", x(wc, this)), x(xc, this).addEventListener("close", x(Cc, this));
|
|
4012
4019
|
}
|
|
4013
4020
|
cancel(e) {
|
|
4014
4021
|
x(Sc, this) && x(xc, this).removeEventListener("message", x(Sc, this)), x(wc, this) && x(xc, this).removeEventListener("error", x(wc, this)), x(Cc, this) && x(xc, this).removeEventListener("close", x(Cc, this));
|
|
@@ -5011,7 +5018,7 @@ var td = class {
|
|
|
5011
5018
|
let n = Math.max(0, Date.now() - x(ad, this)), r = Number(e.expires);
|
|
5012
5019
|
if (r > 0) {
|
|
5013
5020
|
let e = Math.max(t.minGraceTime, Math.min(r / 10, t.maxGraceTime)), i = Math.min(r - e - n, t.maxTimeout);
|
|
5014
|
-
Promise.race([
|
|
5021
|
+
Promise.race([gn(i), this.done().catch(o)]).then(() => x(od, this).resolve(this.expiryState())).catch(o);
|
|
5015
5022
|
}
|
|
5016
5023
|
x(nd, this).resolve(e);
|
|
5017
5024
|
}
|
|
@@ -5593,7 +5600,7 @@ var sf = 2e3, cf = /* @__PURE__ */ new WeakMap(), lf = /* @__PURE__ */ new WeakM
|
|
|
5593
5600
|
params: n
|
|
5594
5601
|
}, [s, c] = Xd(x(uf, r), o);
|
|
5595
5602
|
if (x(lf, r).update((e) => e.set(i, s)), yield x(uf, r).push(o), !(yield Promise.race([s.state.ok(), x(cf, r).closed()]))) throw Error("Session closed");
|
|
5596
|
-
return c.closed().then(() => Promise.race([
|
|
5603
|
+
return c.closed().then(() => Promise.race([gn(sf), r.closed()])).then(() => b(ff, r, hf).call(r, c.id)).catch(() => b(ff, r, hf).call(r, c.id)), c;
|
|
5597
5604
|
} catch (e) {
|
|
5598
5605
|
throw x(df, r).error("Error 'subscribe'", e), e;
|
|
5599
5606
|
}
|
|
@@ -6099,7 +6106,7 @@ function pp() {
|
|
|
6099
6106
|
session: yield up(e),
|
|
6100
6107
|
transportSelectionReason: void 0
|
|
6101
6108
|
};
|
|
6102
|
-
let t = up(e).catch(() => cp(e)), n = yield Promise.race([t,
|
|
6109
|
+
let t = up(e).catch(() => cp(e)), n = yield Promise.race([t, gn(e.websocketFallbackTimeoutMs)]);
|
|
6103
6110
|
return n ? {
|
|
6104
6111
|
session: n,
|
|
6105
6112
|
transportSelectionReason: n.transportType() === "websocket" ? "fallback" : void 0
|
|
@@ -6966,7 +6973,7 @@ function ih(e) {
|
|
|
6966
6973
|
try {
|
|
6967
6974
|
return yield e();
|
|
6968
6975
|
} catch (i) {
|
|
6969
|
-
if (t === n.catalog().current() && r && (yield Promise.race([r,
|
|
6976
|
+
if (t === n.catalog().current() && r && (yield Promise.race([r, gn(500)])), t !== n.catalog().current()) return e();
|
|
6970
6977
|
throw i;
|
|
6971
6978
|
}
|
|
6972
6979
|
})();
|
|
@@ -7115,7 +7122,7 @@ var Ch = 1e4, wh = /* @__PURE__ */ new WeakMap(), Th = /* @__PURE__ */ new WeakS
|
|
|
7115
7122
|
for (;;) {
|
|
7116
7123
|
let [t, n] = e.value.value();
|
|
7117
7124
|
try {
|
|
7118
|
-
yield Promise.race([
|
|
7125
|
+
yield Promise.race([_n(Ch, /* @__PURE__ */ Error("Idle timeout")), n]);
|
|
7119
7126
|
} catch (e) {
|
|
7120
7127
|
return e;
|
|
7121
7128
|
}
|
|
@@ -7510,7 +7517,7 @@ var $h = 1e4, Q = /* @__PURE__ */ new WeakMap(), eg = /* @__PURE__ */ new WeakMa
|
|
|
7510
7517
|
audioTrack: ne == null ? void 0 : ne.track,
|
|
7511
7518
|
burstMs: d.burstMs || 0
|
|
7512
7519
|
}),
|
|
7513
|
-
|
|
7520
|
+
_n($h, /* @__PURE__ */ Error("Timeout waiting for player to start")),
|
|
7514
7521
|
oe
|
|
7515
7522
|
]), v = new Tg(_.catalog());
|
|
7516
7523
|
u.set(bp(h.namespace), v), e.emit("received signal", {
|
|
@@ -7538,7 +7545,7 @@ var $h = 1e4, Q = /* @__PURE__ */ new WeakMap(), eg = /* @__PURE__ */ new WeakMa
|
|
|
7538
7545
|
function mg() {
|
|
7539
7546
|
var e = this;
|
|
7540
7547
|
return t(function* () {
|
|
7541
|
-
x(tg, e).transportType() === "websocket" && (yield
|
|
7548
|
+
x(tg, e).transportType() === "websocket" && (yield gn(5e3));
|
|
7542
7549
|
var t = !1, n = !1, r;
|
|
7543
7550
|
try {
|
|
7544
7551
|
for (var i = U(x($, e).stats()), a; t = !(a = yield i.next()).done; t = !1) {
|
|
@@ -7648,7 +7655,7 @@ function bg(e, n) {
|
|
|
7648
7655
|
let n = d.value;
|
|
7649
7656
|
{
|
|
7650
7657
|
var f;
|
|
7651
|
-
let s = bp(n.track.namespace), c = n.track.trackObject.language, l = fe((f = n.track.trackObject.codec) == null ? "" : f), u = n.track.trackObject.codec, d = l ?
|
|
7658
|
+
let s = bp(n.track.namespace), c = n.track.trackObject.language, l = fe((f = n.track.trackObject.codec) == null ? "" : f), u = n.track.trackObject.codec, d = l ? bn({
|
|
7652
7659
|
codec: l,
|
|
7653
7660
|
codecString: u
|
|
7654
7661
|
}) : void 0, ne = !!n.track.trackObject["com.vindral.drm"];
|
|
@@ -7663,9 +7670,9 @@ function bg(e, n) {
|
|
|
7663
7670
|
drmTransition: a !== void 0 && a !== ne
|
|
7664
7671
|
};
|
|
7665
7672
|
t = s, i = c, a = ne;
|
|
7666
|
-
let h = p.producerReferenceTime(), ee = x(cg, r).get(n.track.namespace)
|
|
7667
|
-
if (h &&
|
|
7668
|
-
x(cg, r).set(n.track.namespace,
|
|
7673
|
+
let h = p.producerReferenceTime(), ee = x(cg, r).get(n.track.namespace), te = performance.now();
|
|
7674
|
+
if (h && (ee === void 0 || te - ee > 1e3)) {
|
|
7675
|
+
x(cg, r).set(n.track.namespace, te);
|
|
7669
7676
|
let t = e.wallclock() - h.getTime();
|
|
7670
7677
|
x(eg, r).debug("timing-info", {
|
|
7671
7678
|
mediaType: p.mediaType(),
|
|
@@ -7738,12 +7745,12 @@ var Sg = /* @__PURE__ */ new WeakMap(), Cg = /* @__PURE__ */ new WeakMap(), wg =
|
|
|
7738
7745
|
}
|
|
7739
7746
|
getAudioTrack(e) {
|
|
7740
7747
|
if (!e.codec) return;
|
|
7741
|
-
let t = x(Cg, this).filter((t) => !(!
|
|
7748
|
+
let t = x(Cg, this).filter((t) => !(!yn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec || e.language && t.language !== e.language));
|
|
7742
7749
|
return t[t.length - 1];
|
|
7743
7750
|
}
|
|
7744
7751
|
getVideoTrack(e) {
|
|
7745
7752
|
if (!e.codec) return;
|
|
7746
|
-
let t = x(Cg, this).filter((t) => !(!
|
|
7753
|
+
let t = x(Cg, this).filter((t) => !(!vn(t) || t.bitRate > e.bitRate || e.codec && t.codec !== e.codec));
|
|
7747
7754
|
return t[t.length - 1];
|
|
7748
7755
|
}
|
|
7749
7756
|
renditions() {
|
|
@@ -7830,7 +7837,7 @@ var Dg = (e, t) => {
|
|
|
7830
7837
|
if (i.isConnectInProgress) return i.logger.info("Connect already in progress"), !1;
|
|
7831
7838
|
if (i.isSuspended) return !1;
|
|
7832
7839
|
if (i.readyState() !== WebSocket.CLOSED && i.close("new connection in progress"), i.shouldContinueConnecting = !0, i._isConnectInProgress = !0, e && i.options.reconnectDelay > 0) {
|
|
7833
|
-
i.logger.info("Waiting for reconnect delay", w({}, i.options)), yield
|
|
7840
|
+
i.logger.info("Waiting for reconnect delay", w({}, i.options)), yield gn(i.options.reconnectDelay);
|
|
7834
7841
|
let e = yield i.options.reconnectHandler(i.reconnectState);
|
|
7835
7842
|
if (i.reconnectState.reconnectRetries++, !e) return i._isConnectInProgress = !1, i.emit("error", s()), !1;
|
|
7836
7843
|
}
|
|
@@ -7898,7 +7905,7 @@ var Dg = (e, t) => {
|
|
|
7898
7905
|
return;
|
|
7899
7906
|
}
|
|
7900
7907
|
let t = JSON.parse(e);
|
|
7901
|
-
if (
|
|
7908
|
+
if (Cn(t)) {
|
|
7902
7909
|
if (t.type === "pong") {
|
|
7903
7910
|
this.handleMessage(e);
|
|
7904
7911
|
return;
|
|
@@ -7936,7 +7943,7 @@ var Dg = (e, t) => {
|
|
|
7936
7943
|
if (e instanceof ArrayBuffer) this.emitter.emit("received data", e);
|
|
7937
7944
|
else {
|
|
7938
7945
|
let t = JSON.parse(e);
|
|
7939
|
-
if (!
|
|
7946
|
+
if (!Cn(t)) return;
|
|
7940
7947
|
switch (t.type) {
|
|
7941
7948
|
case "pong":
|
|
7942
7949
|
this.lastPingSentTime && (this.rtts.push(performance.now() - this.lastPingSentTime), this.isPingInFlight = !1, this.emitter.emit("rtt", Ot(this.rtts.items())));
|
|
@@ -8106,7 +8113,7 @@ var Ig = (e) => {
|
|
|
8106
8113
|
x(t_, this) !== void 0 && (clearTimeout(x(t_, this)), S(t_, this, void 0));
|
|
8107
8114
|
}), y(this, c_, function() {
|
|
8108
8115
|
var e = t(function* (e) {
|
|
8109
|
-
return (yield o.config.reconnectHandler({ reconnectRetries: x(Kg, o) })) ? (x(u_, o).call(o) ? (o.logger.info("Reconnect burst detected, applying backoff before retrying"), yield
|
|
8116
|
+
return (yield o.config.reconnectHandler({ reconnectRetries: x(Kg, o) })) ? (x(u_, o).call(o) ? (o.logger.info("Reconnect burst detected, applying backoff before retrying"), yield gn(n.RECONNECT_BACKOFF_MS)) : o.logger.info(e === "cached_edge" ? "Retrying with next cached edge without backoff" : "Retrying without backoff"), x(Wg, o)) : (o.emitter.emit("error", s()), !1);
|
|
8110
8117
|
});
|
|
8111
8118
|
return function(t) {
|
|
8112
8119
|
return e.apply(this, arguments);
|
|
@@ -8194,12 +8201,12 @@ e(f_, "PING_TIMEOUT", 1e3), e(f_, "RECONNECT_BACKOFF_MS", 1e3), e(f_, "RECONNECT
|
|
|
8194
8201
|
//#endregion
|
|
8195
8202
|
//#region ../../libs/web-sdk/src/modules/ConstraintCapModule.ts
|
|
8196
8203
|
var m_, h_ = () => ({
|
|
8197
|
-
video: w(w({},
|
|
8198
|
-
audio: { bitRate:
|
|
8204
|
+
video: w(w({}, Sn()), {}, { bitRate: xn() }),
|
|
8205
|
+
audio: { bitRate: xn() }
|
|
8199
8206
|
}), g_ = () => ({
|
|
8200
8207
|
width: window.innerWidth,
|
|
8201
8208
|
height: window.innerHeight,
|
|
8202
|
-
bitRate:
|
|
8209
|
+
bitRate: xn()
|
|
8203
8210
|
}), __ = class t {
|
|
8204
8211
|
constructor(n, r, i, a) {
|
|
8205
8212
|
e(this, "emitter", void 0), e(this, "timers", new j()), e(this, "pictureInPictureSource", void 0), e(this, "element", void 0), e(this, "currentCap", void 0), e(this, "userSpecifiedCap", void 0), e(this, "renditionLevelSource", void 0), e(this, "resizeObserver", void 0), e(this, "elementSize", void 0), e(this, "_sizeBasedResolutionCapEnabled", void 0), e(this, "unload", () => {
|
|
@@ -8450,7 +8457,7 @@ var v_ = 5, y_ = 100, b_ = 1e3, x_ = class r {
|
|
|
8450
8457
|
break;
|
|
8451
8458
|
}
|
|
8452
8459
|
case "video": {
|
|
8453
|
-
let { VideoDecoderWorkerContext: n } = yield import("./
|
|
8460
|
+
let { VideoDecoderWorkerContext: n } = yield import("./Bskov1am.js"), r = yield n.create(i.createContext("VideoDecoderWorker"), a, c, l, u, d, () => s.currentTime);
|
|
8454
8461
|
p = r.isWebCodecs, h = r.usingOffscreenCanvas, t.set(e.type, {
|
|
8455
8462
|
buffer: [],
|
|
8456
8463
|
decoderContext: r,
|
|
@@ -8646,7 +8653,7 @@ var k_ = 1e3, A_ = 50, j_ = class t {
|
|
|
8646
8653
|
var r;
|
|
8647
8654
|
super(), r = this, e(this, "context", new (M_())()), e(this, "timers", j.create()), e(this, "previousCurrentTime", 0), e(this, "_isStuck", !1), e(this, "mediaStreamDestination", void 0), e(this, "unload", () => (this.timers.unload(), this.context.removeEventListener("statechange", this.onStateChange), this.context.state === "closed" ? Promise.resolve() : this.context.close())), e(this, "createGain", () => this.context.createGain()), e(this, "createBuffer", (e, t, n) => this.context.createBuffer(e, t, n)), e(this, "createBufferSource", () => this.context.createBufferSource()), e(this, "getMediaStreamDestination", () => (this.mediaStreamDestination || (this.mediaStreamDestination = this.context.createMediaStreamDestination()), this.mediaStreamDestination)), e(this, "getDefaultDestination", () => this.context.destination), e(this, "createSplitter", () => this.context.createChannelSplitter(2)), e(this, "resume", t(function* () {
|
|
8648
8655
|
try {
|
|
8649
|
-
return yield Promise.race([r.context.resume(),
|
|
8656
|
+
return yield Promise.race([r.context.resume(), _n(1e3, p())]);
|
|
8650
8657
|
} catch (e) {
|
|
8651
8658
|
throw r.suspend().catch(o), e;
|
|
8652
8659
|
}
|
|
@@ -9839,12 +9846,12 @@ var vv, yv = () => ({
|
|
|
9839
9846
|
general: yv()
|
|
9840
9847
|
}), xv = class {
|
|
9841
9848
|
constructor(t, n, r) {
|
|
9842
|
-
e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", j.create()), e(this, "metrics", bv()), e(this, "bufferFullness", new v(30)), e(this, "bufferFullnessRegression", void 0), e(this, "currentLevel", void 0), e(this, "isSuspended", !1), e(this, "_fatalQosCount", 0), e(this, "targetBufferTime", 0), e(this, "renditionLevelSource", void 0), e(this, "qualityIndexOrder", []), e(this, "hasAsserted", !1), e(this, "load", () => {
|
|
9843
|
-
this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("buffer fullness", this.onBufferFullness), this.emitter.on("rendition level changed", this.onRenditionLevelChanged), this.emitter.on("video decode rate", this.onVideoDecodeRate), this.emitter.on("target buffer time", this.onTargetBufferTime);
|
|
9849
|
+
e(this, "minBufferFullnessLengthForRegression", 6), e(this, "logger", void 0), e(this, "emitter", void 0), e(this, "timers", j.create()), e(this, "metrics", bv()), e(this, "bufferFullness", new v(30)), e(this, "bufferFullnessRegression", void 0), e(this, "currentLevel", void 0), e(this, "isSuspended", !1), e(this, "_fatalQosCount", 0), e(this, "targetBufferTime", 0), e(this, "renditionLevelSource", void 0), e(this, "qualityIndexOrder", []), e(this, "hasPlayedInSession", !1), e(this, "hasAsserted", !1), e(this, "load", () => {
|
|
9850
|
+
this.emitter.on("playback state", this.onPlaybackState), this.emitter.on("buffer fullness", this.onBufferFullness), this.emitter.on("rendition level changed", this.onRenditionLevelChanged), this.emitter.on("video decode rate", this.onVideoDecodeRate), this.emitter.on("target buffer time", this.onTargetBufferTime), this.emitter.on("connection state", this.onConnectionState);
|
|
9844
9851
|
}), e(this, "unload", () => {
|
|
9845
|
-
this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("buffer fullness", this.onBufferFullness), this.emitter.off("rendition level changed", this.onRenditionLevelChanged), this.emitter.off("video decode rate", this.onVideoDecodeRate), this.emitter.off("target buffer time", this.onTargetBufferTime), this.suspend();
|
|
9852
|
+
this.emitter.off("playback state", this.onPlaybackState), this.emitter.off("buffer fullness", this.onBufferFullness), this.emitter.off("rendition level changed", this.onRenditionLevelChanged), this.emitter.off("video decode rate", this.onVideoDecodeRate), this.emitter.off("target buffer time", this.onTargetBufferTime), this.emitter.off("connection state", this.onConnectionState), this.suspend();
|
|
9846
9853
|
}), e(this, "suspend", () => {
|
|
9847
|
-
this.isSuspended = !0, this.timers.unload(), this.stopBuffering(), this.unsetActive();
|
|
9854
|
+
this.isSuspended = !0, this.timers.unload(), this.stopBuffering(), this.unsetActive(), this.hasPlayedInSession = !1;
|
|
9848
9855
|
}), e(this, "unsuspend", () => {
|
|
9849
9856
|
this.isSuspended = !1, this.currentLevel && this.setActive();
|
|
9850
9857
|
}), e(this, "fatalQosGraceTime", () => 1e4 * (this.fatalQosCount + 1)), e(this, "incrementFatalQosCount", () => {
|
|
@@ -9854,10 +9861,10 @@ var vv, yv = () => ({
|
|
|
9854
9861
|
let a = ((t = (n = e.video) == null ? void 0 : n.bitRate) == null ? 0 : t) + ((r = (i = e.audio) == null ? void 0 : i.bitRate) == null ? 0 : r);
|
|
9855
9862
|
return this.metrics.levels[a];
|
|
9856
9863
|
}), e(this, "getBufferFullnessRegression", () => this.bufferFullnessRegression), e(this, "getTargetBufferTime", () => this.targetBufferTime), e(this, "activeRatios", () => {
|
|
9857
|
-
let e = /* @__PURE__ */ new Map(), t =
|
|
9864
|
+
let e = /* @__PURE__ */ new Map(), t = dn(this.metrics.general.activeRanges);
|
|
9858
9865
|
if (Object.entries(this.metrics.levels).forEach(([n, r]) => {
|
|
9859
9866
|
var i;
|
|
9860
|
-
let a = parseInt(n, 10), o = t ?
|
|
9867
|
+
let a = parseInt(n, 10), o = t ? dn(r.activeRanges) / t : 0, s = this.getQualityIndex(a).toString();
|
|
9861
9868
|
e.set(s, ((i = e.get(s)) == null ? 0 : i) + o);
|
|
9862
9869
|
}), !this.hasAsserted) {
|
|
9863
9870
|
let t = e.size ? Math.abs(Array.from(e.values()).reduce((e, t) => e + t, 0) - 1) <= .02 : !0;
|
|
@@ -9865,17 +9872,17 @@ var vv, yv = () => ({
|
|
|
9865
9872
|
}
|
|
9866
9873
|
return e;
|
|
9867
9874
|
}), e(this, "bufferingRatios", () => {
|
|
9868
|
-
let e = /* @__PURE__ */ new Map(), t =
|
|
9875
|
+
let e = /* @__PURE__ */ new Map(), t = dn(this.metrics.general.bufferingRanges);
|
|
9869
9876
|
if (Object.entries(this.metrics.levels).forEach(([n, r]) => {
|
|
9870
9877
|
var i;
|
|
9871
|
-
let a = parseInt(n, 10), o = t ?
|
|
9878
|
+
let a = parseInt(n, 10), o = t ? dn(r.bufferingRanges) / t : 0, s = this.getQualityIndex(a).toString();
|
|
9872
9879
|
e.set(s, ((i = e.get(s)) == null ? 0 : i) + o);
|
|
9873
9880
|
}), !this.hasAsserted) {
|
|
9874
9881
|
let t = Array.from(e.values()).reduce((e, t) => e + t, 0) <= 1;
|
|
9875
9882
|
t || (this.hasAsserted = !0, console.assert(t, `Buffering ratios should be less than 1 - actual: ${Array.from(e.values()).reduce((e, t) => e + t, 0)}`));
|
|
9876
9883
|
}
|
|
9877
9884
|
return e;
|
|
9878
|
-
}), e(this, "bufferingEventsLast", (e) => this.metrics.general.bufferingRanges.filter((t) => t.start >= performance.now() - e).length), e(this, "timeSpentBufferingLast", (e) =>
|
|
9885
|
+
}), e(this, "bufferingEventsLast", (e) => this.metrics.general.bufferingRanges.filter((t) => t.start >= performance.now() - e).length), e(this, "timeSpentBufferingLast", (e) => fn(this.metrics.general.bufferingRanges, e)), e(this, "timeSpentActiveLast", (e) => fn(this.metrics.general.activeRanges, e)), e(this, "timeSpentPlayingInAtLeastLevelRatio", (e) => {
|
|
9879
9886
|
var t, n, r, i;
|
|
9880
9887
|
let a = this.timeSpentBuffering(), o = this.timeActive(), s = this.bufferingRatios(), c = this.activeRatios(), l = ((t = (n = e.video) == null ? void 0 : n.bitRate) == null ? 0 : t) + ((r = (i = e.audio) == null ? void 0 : i.bitRate) == null ? 0 : r), u = a / o;
|
|
9881
9888
|
return Object.keys(this.metrics.levels).map((e) => parseInt(e, 10)).filter((e) => e >= l).reduce((e, t) => {
|
|
@@ -9883,7 +9890,7 @@ var vv, yv = () => ({
|
|
|
9883
9890
|
let i = this.getQualityIndex(t).toString();
|
|
9884
9891
|
return ((n = c.get(i)) == null ? 0 : n) - ((r = s.get(i)) == null ? 0 : r) * u + e;
|
|
9885
9892
|
}, 0);
|
|
9886
|
-
}), e(this, "timeSpentBuffering", () =>
|
|
9893
|
+
}), e(this, "timeSpentBuffering", () => dn(this.metrics.general.bufferingRanges)), e(this, "timeActive", () => dn(this.metrics.general.activeRanges)), e(this, "getStatistics", () => {
|
|
9887
9894
|
let e = this.timeSpentBuffering(), t = this.timeActive(), n = this.metrics.general.bufferingRanges.length, r = this.activeRatios(), i = t / 6e4, a = t > 0 ? e / t : 0, o = Math.max(i, 1), s = i > 0 ? n / o : 0, c = [...r].reduce((e, [t, n]) => e + parseInt(t, 10) * n, 0), l = 6e4, u = this.timeSpentActiveLast(l), d = this.timeSpentBufferingLast(l), f = u > 0 ? d / u : 0, p = this.metrics.general.upgradesFromLevel.length + this.metrics.general.downgradesFromLevel.length, m = i > 0 ? p / o : 0, h = n > 0 ? e / n : 0;
|
|
9888
9895
|
return {
|
|
9889
9896
|
timeSpentBuffering: e,
|
|
@@ -9908,14 +9915,14 @@ var vv, yv = () => ({
|
|
|
9908
9915
|
if (e.from) {
|
|
9909
9916
|
var f;
|
|
9910
9917
|
let e = (f = this.metrics.levels[l]) == null ? yv() : f;
|
|
9911
|
-
l < u ? e.upgradesFromLevel.push(performance.now()) : e.downgradesFromLevel.push(performance.now()),
|
|
9918
|
+
l < u ? e.upgradesFromLevel.push(performance.now()) : e.downgradesFromLevel.push(performance.now()), ln(e.activeRanges);
|
|
9912
9919
|
let t = e.bufferingRanges[e.bufferingRanges.length - 1];
|
|
9913
|
-
d = !!t && !t.end,
|
|
9920
|
+
d = !!t && !t.end, ln(e.bufferingRanges), this.metrics.levels[l] = e;
|
|
9914
9921
|
}
|
|
9915
9922
|
if (e.to) {
|
|
9916
9923
|
var p;
|
|
9917
9924
|
let e = (p = this.metrics.levels[u]) == null ? yv() : p;
|
|
9918
|
-
|
|
9925
|
+
un(e.activeRanges), d && un(e.bufferingRanges), this.metrics.levels[u] = e, this.currentLevel = u;
|
|
9919
9926
|
}
|
|
9920
9927
|
}), e(this, "onBufferFullness", (e) => {
|
|
9921
9928
|
this.bufferFullness.push(e), this.metrics.bufferFullness = e, this.bufferFullness.items().length >= this.minBufferFullnessLengthForRegression && (this.bufferFullnessRegression = this.calculateLinearRegression());
|
|
@@ -9925,12 +9932,14 @@ var vv, yv = () => ({
|
|
|
9925
9932
|
currentLevel: this.currentLevel
|
|
9926
9933
|
}), e) {
|
|
9927
9934
|
case "playing":
|
|
9928
|
-
this.stopBuffering();
|
|
9935
|
+
this.hasPlayedInSession = !0, this.stopBuffering();
|
|
9929
9936
|
break;
|
|
9930
9937
|
case "buffering":
|
|
9931
|
-
this.isSuspended
|
|
9938
|
+
!this.isSuspended && this.hasPlayedInSession && this.startBuffering();
|
|
9932
9939
|
break;
|
|
9933
9940
|
}
|
|
9941
|
+
}), e(this, "onConnectionState", (e) => {
|
|
9942
|
+
e !== "connected" && this.isSuspended && (this.hasPlayedInSession = !1);
|
|
9934
9943
|
}), e(this, "onVideoDecodeRate", (e) => {
|
|
9935
9944
|
var t;
|
|
9936
9945
|
if (this.metrics.general.decodeRate = e, !this.currentLevel) return;
|
|
@@ -9944,21 +9953,21 @@ var vv, yv = () => ({
|
|
|
9944
9953
|
})))), e(this, "stopBuffering", () => {
|
|
9945
9954
|
if (this.currentLevel) {
|
|
9946
9955
|
let e = this.metrics.levels[this.currentLevel];
|
|
9947
|
-
e &&
|
|
9956
|
+
e && ln(e.bufferingRanges);
|
|
9948
9957
|
}
|
|
9949
|
-
|
|
9958
|
+
ln(this.metrics.general.bufferingRanges);
|
|
9950
9959
|
}), e(this, "startBuffering", () => {
|
|
9951
9960
|
if (this.currentLevel) {
|
|
9952
9961
|
let e = this.metrics.levels[this.currentLevel];
|
|
9953
|
-
e &&
|
|
9962
|
+
e && un(e.bufferingRanges);
|
|
9954
9963
|
}
|
|
9955
|
-
|
|
9964
|
+
un(this.metrics.general.bufferingRanges);
|
|
9956
9965
|
}), e(this, "unsetActive", () => {
|
|
9957
9966
|
if (this.currentLevel) {
|
|
9958
9967
|
let e = this.metrics.levels[this.currentLevel];
|
|
9959
|
-
e &&
|
|
9968
|
+
e && ln(e.activeRanges);
|
|
9960
9969
|
}
|
|
9961
|
-
|
|
9970
|
+
ln(this.metrics.general.activeRanges);
|
|
9962
9971
|
}), e(this, "getQualityIndex", (e) => {
|
|
9963
9972
|
if (!this.qualityIndexOrder.length) {
|
|
9964
9973
|
var t, n;
|
|
@@ -9978,9 +9987,9 @@ var vv, yv = () => ({
|
|
|
9978
9987
|
setActive() {
|
|
9979
9988
|
if (this.currentLevel) {
|
|
9980
9989
|
let e = this.metrics.levels[this.currentLevel];
|
|
9981
|
-
e &&
|
|
9990
|
+
e && un(e.activeRanges);
|
|
9982
9991
|
}
|
|
9983
|
-
|
|
9992
|
+
un(this.metrics.general.activeRanges);
|
|
9984
9993
|
}
|
|
9985
9994
|
};
|
|
9986
9995
|
vv = xv, e(xv, "create", (e, t, n) => new vv(e, t, n));
|
|
@@ -10000,16 +10009,16 @@ var Sv, Cv = class {
|
|
|
10000
10009
|
this.renditions.set(e, t);
|
|
10001
10010
|
}), e(this, "getLanguages", () => this.languages), e(this, "getVideoRendition", (e, t = this.getCurrentSubscription().channelId) => {
|
|
10002
10011
|
let n = this.getRendition(e, t);
|
|
10003
|
-
if (n &&
|
|
10012
|
+
if (n && vn(n)) return n;
|
|
10004
10013
|
}), e(this, "getAudioRenditions", (e) => {
|
|
10005
10014
|
let t = this.renditions.get(e);
|
|
10006
|
-
return t == null ? void 0 : t.filter((e) =>
|
|
10015
|
+
return t == null ? void 0 : t.filter((e) => yn(e));
|
|
10007
10016
|
}), e(this, "getVideoRenditions", (e) => {
|
|
10008
10017
|
let t = this.renditions.get(e);
|
|
10009
|
-
return t == null ? void 0 : t.filter((e) =>
|
|
10018
|
+
return t == null ? void 0 : t.filter((e) => vn(e));
|
|
10010
10019
|
}), e(this, "getAudioRendition", (e, t = this.getCurrentSubscription().channelId) => {
|
|
10011
10020
|
let n = this.getRendition(e, t);
|
|
10012
|
-
if (n &&
|
|
10021
|
+
if (n && yn(n)) return n;
|
|
10013
10022
|
}), e(this, "getRendition", (e, t = this.getCurrentSubscription().channelId) => {
|
|
10014
10023
|
var n;
|
|
10015
10024
|
return (n = this.renditions.get(t)) == null ? void 0 : n.find((t) => t.id === e);
|
|
@@ -10049,7 +10058,7 @@ var Sv, Cv = class {
|
|
|
10049
10058
|
}));
|
|
10050
10059
|
}), e(this, "createRenditionLevels", (e) => {
|
|
10051
10060
|
var t;
|
|
10052
|
-
let { video: n, audio: r, channelId: i } = e, a = (t = this.renditions.get(i)) == null ? [] : t, o = a.filter(
|
|
10061
|
+
let { video: n, audio: r, channelId: i } = e, a = (t = this.renditions.get(i)) == null ? [] : t, o = a.filter(vn).filter((e) => n && e.codec === n.codec), s = a.filter(yn).filter((e) => r && e.codec === r.codec && e.language === r.language), c = Math.max(o.length, s.length), l = [];
|
|
10053
10062
|
for (let e = 0; e < c; e++) {
|
|
10054
10063
|
let t = o[Math.min(o.length - 1, e)], n = s[Math.min(s.length - 1, e)];
|
|
10055
10064
|
l.push({
|
|
@@ -10690,7 +10699,7 @@ var Uv = class {
|
|
|
10690
10699
|
}
|
|
10691
10700
|
return "wasm";
|
|
10692
10701
|
}, Xv = (e, t, n) => {
|
|
10693
|
-
if (
|
|
10702
|
+
if (vn(t)) return w(w({}, e), {}, {
|
|
10694
10703
|
type: "video",
|
|
10695
10704
|
codec: t.codec,
|
|
10696
10705
|
isSync: Jo(e.flags),
|
|
@@ -10820,10 +10829,10 @@ var Uv = class {
|
|
|
10820
10829
|
return this.inFlight.set(e, o), o;
|
|
10821
10830
|
}), this.logger = n;
|
|
10822
10831
|
}
|
|
10823
|
-
}, sy = /* @__PURE__ */ new WeakMap(),
|
|
10832
|
+
}, sy = 1e4, cy = /* @__PURE__ */ new WeakMap(), ly = /* @__PURE__ */ new WeakMap(), uy = /* @__PURE__ */ new WeakMap(), dy = class n extends ge {
|
|
10824
10833
|
constructor(r) {
|
|
10825
10834
|
var i, a;
|
|
10826
|
-
super(), i = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", rt()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ge()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId",
|
|
10835
|
+
super(), i = this, e(this, "pictureInPicture", void 0), e(this, "drm", void 0), e(this, "browser", rt()), e(this, "options", void 0), e(this, "element", void 0), e(this, "playbackSource", void 0), e(this, "emitter", new ge()), e(this, "logger", void 0), e(this, "modules", void 0), e(this, "clientIp", void 0), e(this, "sessionId", void 0), e(this, "clientId", hn()), e(this, "_channels", []), e(this, "createdAt", performance.now()), e(this, "offscreenCanvasElement", void 0), e(this, "webCodecsRenditionSupport", void 0), e(this, "hasCalledConnect", !1), e(this, "latestEmittedLanguages", []), e(this, "wakeLock", void 0), e(this, "pool", new xe(n.MAX_POOL_SIZE)), e(this, "userAgentInformation", new mn()), e(this, "encryptedMediaExtensions", void 0), y(this, cy, 0), y(this, ly, []), e(this, "sampleProcessingSesssions", /* @__PURE__ */ new Map()), e(this, "sizes", /* @__PURE__ */ new Map()), e(this, "isSuspended", !0), e(this, "disconnectTimeout", void 0), e(this, "offscreenSubtitleInterval", void 0), y(this, uy, void 0), e(this, "attach", (e) => {
|
|
10827
10836
|
var t;
|
|
10828
10837
|
(t = this.wakeLock) == null || t.attach(e), e.appendChild(this.element);
|
|
10829
10838
|
}), e(this, "setElement", (e) => {
|
|
@@ -10866,7 +10875,7 @@ var Uv = class {
|
|
|
10866
10875
|
})), e(this, "onConnectInfo", function() {
|
|
10867
10876
|
var e = t(function* (e) {
|
|
10868
10877
|
var n;
|
|
10869
|
-
i.sessionId =
|
|
10878
|
+
i.sessionId = hn();
|
|
10870
10879
|
let r = i.modules.subscription.getTargetSubscription(), a = e.channels.find((e) => e.channelId === r.channelId);
|
|
10871
10880
|
if (i.emitter.emit("connect info", e), "timeshift" in e && e.timeshift ? (e.timeshift, i._channels = e.channels.map((t) => w(w({}, t), {}, { timeshift: e.timeshift })), i.emit("timeshift info", e.timeshift)) : i._channels = e.channels, i.updateTextTracks((n = a == null ? void 0 : a.renditions) == null ? [] : n), !i.textTrack && i.options.get("textTrack") && (i.textTrack = i.options.get("textTrack")), yield Promise.all(e.channels.map(function() {
|
|
10872
10881
|
var e = t(function* (e) {
|
|
@@ -10906,31 +10915,31 @@ var Uv = class {
|
|
|
10906
10915
|
}), e(this, "updateTextTracks", (e) => {
|
|
10907
10916
|
let t = e.filter((e) => e.codec === "webvtt");
|
|
10908
10917
|
t.forEach((e) => {
|
|
10909
|
-
if (!x(
|
|
10918
|
+
if (!x(ly, this).find((t) => t.language === e.language)) {
|
|
10910
10919
|
if (this.modules.canvasModule) {
|
|
10911
10920
|
let t = this.modules.canvasModule.textTracks.addTextTrack(e.kind, e.label || e.language || "", e.language || "");
|
|
10912
|
-
x(
|
|
10921
|
+
x(ly, this).push(t);
|
|
10913
10922
|
} else if (this.mediaElement instanceof HTMLVideoElement) {
|
|
10914
10923
|
let t = this.mediaElement.addTextTrack(e.kind, e.label || e.language, e.language);
|
|
10915
|
-
x(
|
|
10924
|
+
x(ly, this).push(t);
|
|
10916
10925
|
}
|
|
10917
10926
|
}
|
|
10918
10927
|
});
|
|
10919
|
-
for (let e of x(
|
|
10928
|
+
for (let e of x(ly, this)) t.find((t) => t.language === e.language) ? e.mode === "disabled" && (e.mode = "hidden") : e.mode = "disabled";
|
|
10920
10929
|
this.emit("text tracks", this.textTracks);
|
|
10921
10930
|
}), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
|
|
10922
|
-
x(
|
|
10931
|
+
x(ly, this).forEach((t) => {
|
|
10923
10932
|
if (t.cues) for (let n of t.cues) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
|
|
10924
10933
|
});
|
|
10925
10934
|
}), e(this, "filterRenditions", function() {
|
|
10926
10935
|
var e = t(function* (e) {
|
|
10927
10936
|
let n = yield Promise.all(e.map(function() {
|
|
10928
10937
|
var e = t(function* (e) {
|
|
10929
|
-
if (
|
|
10938
|
+
if (yn(e)) {
|
|
10930
10939
|
var t;
|
|
10931
|
-
return i.willUseMediaSource() && !((t = Be()) != null && t.isTypeSupported(
|
|
10940
|
+
return i.willUseMediaSource() && !((t = Be()) != null && t.isTypeSupported(bn(e))) ? !1 : i.willUseMediaSource() || e.codec === "opus" ? !0 : i.isWebCodecsAudioAvailable(i.channelId) ? i.webCodecsRenditionSupport.checkAudioSupport(e) : !1;
|
|
10932
10941
|
}
|
|
10933
|
-
if (!
|
|
10942
|
+
if (!vn(e) || !i.isSupportedVideoCodecProfile(e.codec, e.codecString)) return !1;
|
|
10934
10943
|
if (!i.willUseMediaSource()) return i.isWebCodecsVideoAvailable(i.channelId) ? i.webCodecsRenditionSupport.checkVideoSupport(e) : !0;
|
|
10935
10944
|
let n = yield ps(e);
|
|
10936
10945
|
if (!n.supported) return !1;
|
|
@@ -10951,7 +10960,7 @@ var Uv = class {
|
|
|
10951
10960
|
a.length > 0 && i.logger.debug("unsupported renditions filtered out", { renditions: a.map((e) => w(w({
|
|
10952
10961
|
codec: e.codec,
|
|
10953
10962
|
codecString: e.codecString
|
|
10954
|
-
},
|
|
10963
|
+
}, vn(e) ? {
|
|
10955
10964
|
width: e.width,
|
|
10956
10965
|
height: e.height
|
|
10957
10966
|
} : {}), {}, { bitRate: e.bitRate })) });
|
|
@@ -10970,7 +10979,7 @@ var Uv = class {
|
|
|
10970
10979
|
}), r = r.filter((e) => e.codec !== "av1")), i.logger.debug("supported renditions", { renditions: r.map((e) => w(w({
|
|
10971
10980
|
codec: e.codec,
|
|
10972
10981
|
codecString: e.codecString
|
|
10973
|
-
},
|
|
10982
|
+
}, vn(e) ? {
|
|
10974
10983
|
width: e.width,
|
|
10975
10984
|
height: e.height
|
|
10976
10985
|
} : {}), {}, { bitRate: e.bitRate })) }), r;
|
|
@@ -10979,7 +10988,7 @@ var Uv = class {
|
|
|
10979
10988
|
return e.apply(this, arguments);
|
|
10980
10989
|
};
|
|
10981
10990
|
}()), e(this, "patchSubscription", (e, t) => {
|
|
10982
|
-
let n = this.options.get("maxInitialBitRate"), r = Math.min(this.options.get("maxVideoBitRate"), n, t, this.targetSubscription.video.bitRate), i = Math.min(this.options.get("maxAudioBitRate"), n, t, this.targetSubscription.audio.bitRate), a = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), o = this.supportedAudioCodecs(), s = e.renditions.filter(
|
|
10991
|
+
let n = this.options.get("maxInitialBitRate"), r = Math.min(this.options.get("maxVideoBitRate"), n, t, this.targetSubscription.video.bitRate), i = Math.min(this.options.get("maxAudioBitRate"), n, t, this.targetSubscription.audio.bitRate), a = this.options.get("media") === "audio" ? [] : this.options.get("videoCodecs", this.channelId), o = this.supportedAudioCodecs(), s = e.renditions.filter(yn), c = e.renditions.filter(vn), l = o.find((e) => s.find((t) => t.codec === e) !== void 0), u = a.find((e) => c.find((t) => t.codec === e) !== void 0), d = s.map((e) => e.language);
|
|
10983
10992
|
if (this.logger.debug("supported and selected codecs", {
|
|
10984
10993
|
audioCodecs: o,
|
|
10985
10994
|
videoCodecs: a,
|
|
@@ -11009,7 +11018,7 @@ var Uv = class {
|
|
|
11009
11018
|
}), e(this, "isSupportedVideoCodecProfile", (e, t) => {
|
|
11010
11019
|
if (this.willUseMediaSource()) {
|
|
11011
11020
|
let n = Be();
|
|
11012
|
-
return n ? n.isTypeSupported(
|
|
11021
|
+
return n ? n.isTypeSupported(bn({
|
|
11013
11022
|
codec: e,
|
|
11014
11023
|
codecString: t
|
|
11015
11024
|
})) : !0;
|
|
@@ -11033,12 +11042,12 @@ var Uv = class {
|
|
|
11033
11042
|
});
|
|
11034
11043
|
if (t != null && t.video && n.push({
|
|
11035
11044
|
type: "video",
|
|
11036
|
-
mimeType:
|
|
11045
|
+
mimeType: bn(t.video),
|
|
11037
11046
|
codec: t.video.codec
|
|
11038
11047
|
}), t != null && t.audio && n.push({
|
|
11039
11048
|
type: "audio",
|
|
11040
11049
|
codec: t.audio.codec,
|
|
11041
|
-
mimeType:
|
|
11050
|
+
mimeType: bn(t.audio),
|
|
11042
11051
|
channels: t.audio.channels,
|
|
11043
11052
|
sampleRate: t.audio.sampleRate
|
|
11044
11053
|
}), n.length === 0) throw new g("Can't initialize decoding module without tracks", {
|
|
@@ -11052,7 +11061,7 @@ var Uv = class {
|
|
|
11052
11061
|
}
|
|
11053
11062
|
let a = i.shouldUseWebCodecs(i.channelId), o = i.options.get("webcodecsHardwareAcceleration", i.channelId), s = i.shouldUseOffscreenCanvas(i.channelId) && a, c = typeof OffscreenCanvas < "u" && typeof HTMLCanvasElement < "u" && typeof HTMLCanvasElement.prototype.transferControlToOffscreen == "function", l = s && c && typeof VideoDecoder < "u", u, d;
|
|
11054
11063
|
if (l) try {
|
|
11055
|
-
d = document.createElement("canvas"),
|
|
11064
|
+
d = document.createElement("canvas"), Dn(d), u = d.transferControlToOffscreen();
|
|
11056
11065
|
} catch (e) {
|
|
11057
11066
|
u = void 0, d = void 0, i.logger.warn("Failed to enable OffscreenCanvas; falling back to main thread rendering", { error: e });
|
|
11058
11067
|
}
|
|
@@ -11098,7 +11107,7 @@ var Uv = class {
|
|
|
11098
11107
|
ds(this);
|
|
11099
11108
|
}), e(this, "play", () => {
|
|
11100
11109
|
var e;
|
|
11101
|
-
this.hasCalledConnect ? this.unsuspend() : this.playbackState !== "playing" && (this._connect(), self.addEventListener("__vindral_register_debug__", this.registerDebugInstance), this.modules.timer.setInterval(() => this.cleanupTextTracks(), n.REMOVE_CUE_THRESHOLD)), (e = this.wakeLock) == null || e.enable(), this.playbackState === "paused" && (this.resetModules(), this.emitter.emit("flush buffers"), this.cleanupTextTracks(2 ** 53 - 1)), this.playbackSource.play();
|
|
11110
|
+
this.hasCalledConnect ? this.unsuspend() : this.playbackState !== "playing" && (this._connect(), self.addEventListener("__vindral_register_debug__", this.registerDebugInstance), this.modules.timer.setInterval(() => this.cleanupTextTracks(), n.REMOVE_CUE_THRESHOLD)), (e = this.wakeLock) == null || e.enable(), this.playbackState === "paused" && this.playbackSource.isActivated && (this.resetModules(), this.emitter.emit("flush buffers"), this.cleanupTextTracks(2 ** 53 - 1)), this.playbackSource.play();
|
|
11102
11111
|
}), e(this, "getStatistics", () => {
|
|
11103
11112
|
let e = Object.values(this.modules).reduce((e, t) => t && "getStatistics" in t ? w(w({}, e), t.getStatistics()) : e, this.getRuntimeInfo()), t = Math.round(this.timeActive > 0 ? (e.bytesReceived || 0) * 8 / (this.timeActive / 1e3) : 0), n = this.uptime / 36e5, r = Math.max(0, (e.connectCount || 0) - 1), i = n > 0 ? r / n : 0, a = this.timeActive / 6e4, o = Math.max(a, 1), s = a > 0 ? (e.seekAdjustmentCount || 0) / o : 0, c = a > 0 ? (e.timeshiftAdjustmentCount || 0) / o : 0;
|
|
11104
11113
|
return ty(w(w({}, e), {}, {
|
|
@@ -11110,12 +11119,12 @@ var Uv = class {
|
|
|
11110
11119
|
}), e(this, "resetModules", () => {
|
|
11111
11120
|
Object.values(this.modules).forEach((e) => {
|
|
11112
11121
|
e && "reset" in e && e.reset();
|
|
11113
|
-
}), this.sampleProcessingSesssions.clear(), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
|
|
11122
|
+
}), this.playbackSource instanceof fs && this.modules.adaptivity.reset(sy), this.sampleProcessingSesssions.clear(), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
|
|
11114
11123
|
}), e(this, "getRuntimeInfo", () => {
|
|
11115
11124
|
let e = this.modules.canvasModule instanceof J_ ? !0 : void 0;
|
|
11116
11125
|
return w({
|
|
11117
11126
|
uptime: this.uptime,
|
|
11118
|
-
version: "4.
|
|
11127
|
+
version: "4.4.0",
|
|
11119
11128
|
clientId: this.clientId,
|
|
11120
11129
|
sessionId: this.sessionId,
|
|
11121
11130
|
channelId: this.channelId,
|
|
@@ -11149,7 +11158,7 @@ var Uv = class {
|
|
|
11149
11158
|
}), e(this, "timeToFirstFrame", () => {
|
|
11150
11159
|
let e = this.modules.playback.getFirstFrameTime(), t = this.modules.connection.firstConnectStartTime;
|
|
11151
11160
|
if (t !== void 0 && e !== void 0) return Math.round(e - t);
|
|
11152
|
-
}), this.options = new Uv(w(w({},
|
|
11161
|
+
}), this.options = new Uv(w(w({}, wn), iy(r))), r.telemetryEnabled === void 0 && ["localhost", "127.0.0.1"].includes(location.hostname) && this.options.set("telemetryEnabled", !1);
|
|
11153
11162
|
let o = {
|
|
11154
11163
|
channelId: this.options.get("channelId"),
|
|
11155
11164
|
audio: {
|
|
@@ -11299,7 +11308,7 @@ var Uv = class {
|
|
|
11299
11308
|
case "upgrade":
|
|
11300
11309
|
{
|
|
11301
11310
|
var o, s, c, l, u;
|
|
11302
|
-
let e = Math.min(r + 1, i), n = t[e], d = (o = this.modules.connection.estimatedBandwidth) == null ?
|
|
11311
|
+
let e = Math.min(r + 1, i), n = t[e], d = (o = this.modules.connection.estimatedBandwidth) == null ? xn() : o, f = ((s = n == null || (c = n.audio) == null ? void 0 : c.bitRate) == null ? 0 : s) + ((l = n == null || (u = n.video) == null ? void 0 : u.bitRate) == null ? 0 : l), p = d * 2 > f;
|
|
11303
11312
|
n && p && this.modules.adaptivity.isQoSOk(n) && (a = e);
|
|
11304
11313
|
}
|
|
11305
11314
|
break;
|
|
@@ -11322,8 +11331,8 @@ var Uv = class {
|
|
|
11322
11331
|
audio: w(w({}, this.targetSubscription.audio), d == null ? void 0 : d.audio)
|
|
11323
11332
|
})), this.emitter.emit("adapted level");
|
|
11324
11333
|
}), this.emitter.on("text track data", (e) => {
|
|
11325
|
-
let t = x(
|
|
11326
|
-
if (S(
|
|
11334
|
+
let t = x(ly, this).find((t) => t.language === e.language), n = this.modules.sync.getTimeshiftOffset() / 1e3, r = n - x(cy, this);
|
|
11335
|
+
if (S(cy, this, n), t) {
|
|
11327
11336
|
if (t.cues) for (let e of t.cues) e.startTime -= r, e.endTime -= r;
|
|
11328
11337
|
for (let r of e.cues) {
|
|
11329
11338
|
let e = new VTTCue(r.startTime - n, r.endTime - n, r.text);
|
|
@@ -11339,13 +11348,13 @@ var Uv = class {
|
|
|
11339
11348
|
this.clientIp = t.ip;
|
|
11340
11349
|
break;
|
|
11341
11350
|
case "renditions":
|
|
11342
|
-
this.updateTextTracks(t.renditions), S(
|
|
11351
|
+
this.updateTextTracks(t.renditions), S(uy, this, this.filterRenditions(t.renditions).then((e) => {
|
|
11343
11352
|
this.emitter.emit("renditions", {
|
|
11344
11353
|
renditions: e,
|
|
11345
11354
|
channelId: this.currentSubscription.channelId
|
|
11346
11355
|
}), this.emit("rendition levels", this.modules.renditions.getRenditionLevels()), this.emitLanguagesIfChanged();
|
|
11347
11356
|
}).finally(() => {
|
|
11348
|
-
S(
|
|
11357
|
+
S(uy, this, void 0);
|
|
11349
11358
|
}));
|
|
11350
11359
|
break;
|
|
11351
11360
|
case "subscription changed":
|
|
@@ -11466,7 +11475,7 @@ var Uv = class {
|
|
|
11466
11475
|
let be = function() {
|
|
11467
11476
|
var e = t(function* (e) {
|
|
11468
11477
|
let t = e.channelId;
|
|
11469
|
-
x(
|
|
11478
|
+
x(uy, i) && (yield x(uy, i));
|
|
11470
11479
|
let n = i.modules.renditions.getRendition(e.renditionId, t);
|
|
11471
11480
|
if (!Xo(e.flags)) {
|
|
11472
11481
|
if (Zo(e.flags)) {
|
|
@@ -11474,8 +11483,8 @@ var Uv = class {
|
|
|
11474
11483
|
if (e.renditionId !== 0) {
|
|
11475
11484
|
let e = ce(t);
|
|
11476
11485
|
if (e && e.language !== void 0) {
|
|
11477
|
-
let t = new cs().parse(e.content || ""), r = n / 1e3, a = x(
|
|
11478
|
-
if (S(
|
|
11486
|
+
let t = new cs().parse(e.content || ""), r = n / 1e3, a = x(ly, i).find((t) => t.language === e.language), o = r - x(cy, i);
|
|
11487
|
+
if (S(cy, i, r), a) {
|
|
11479
11488
|
if (a.cues) for (let e of a.cues) e.startTime -= o, e.endTime -= o;
|
|
11480
11489
|
for (let e of t) {
|
|
11481
11490
|
let t = new VTTCue(e.startTime - r, e.endTime - r, e.text);
|
|
@@ -11498,7 +11507,7 @@ var Uv = class {
|
|
|
11498
11507
|
codec: n.codec
|
|
11499
11508
|
}, e), {}, { channelId: t }), o = Bo(a.codec, a.payload);
|
|
11500
11509
|
o && i.sizes.set(a.renditionId, o);
|
|
11501
|
-
let s =
|
|
11510
|
+
let s = bn({
|
|
11502
11511
|
codec: n.codec,
|
|
11503
11512
|
codecString: n.codecString
|
|
11504
11513
|
});
|
|
@@ -11525,7 +11534,7 @@ var Uv = class {
|
|
|
11525
11534
|
return e.apply(this, arguments);
|
|
11526
11535
|
};
|
|
11527
11536
|
}();
|
|
11528
|
-
this.options.get("maxVideoBitRate") !== 2 ** 53 - 1 && (this.maxVideoBitRate = this.options.get("maxVideoBitRate")), this.options.get("maxAudioBitRate") !== 2 ** 53 - 1 && (this.maxAudioBitRate = this.options.get("maxAudioBitRate")), Ft(this.options.get("maxSize"),
|
|
11537
|
+
this.options.get("maxVideoBitRate") !== 2 ** 53 - 1 && (this.maxVideoBitRate = this.options.get("maxVideoBitRate")), this.options.get("maxAudioBitRate") !== 2 ** 53 - 1 && (this.maxAudioBitRate = this.options.get("maxAudioBitRate")), Ft(this.options.get("maxSize"), Sn()) || (this.maxSize = this.options.get("maxSize")), this.options.get("burstEnabled") && te.enableBurst(this.targetBufferTime);
|
|
11529
11538
|
}
|
|
11530
11539
|
set volume(e) {
|
|
11531
11540
|
this.playbackSource.volume = e;
|
|
@@ -11618,7 +11627,7 @@ var Uv = class {
|
|
|
11618
11627
|
this.modules.subscription.setLanguage(e), this.alignSizeAndBitRate(this.targetSubscription);
|
|
11619
11628
|
}
|
|
11620
11629
|
set textTrack(e) {
|
|
11621
|
-
e !== this.textTrack && (x(
|
|
11630
|
+
e !== this.textTrack && (x(ly, this).forEach((t) => {
|
|
11622
11631
|
if (t.label === e) t.mode = "showing";
|
|
11623
11632
|
else {
|
|
11624
11633
|
if (t.mode === "showing" && t.cues) for (let e of [...t.cues]) t.removeCue(e);
|
|
@@ -11627,11 +11636,11 @@ var Uv = class {
|
|
|
11627
11636
|
}), this.emitter.emit("text track", e));
|
|
11628
11637
|
}
|
|
11629
11638
|
get textTracks() {
|
|
11630
|
-
return x(
|
|
11639
|
+
return x(ly, this).filter((e) => e.mode !== "disabled").map((e) => e.label);
|
|
11631
11640
|
}
|
|
11632
11641
|
get textTrack() {
|
|
11633
11642
|
var e;
|
|
11634
|
-
return (e = x(
|
|
11643
|
+
return (e = x(ly, this).find((e) => e.mode === "showing")) == null ? void 0 : e.label;
|
|
11635
11644
|
}
|
|
11636
11645
|
get channelId() {
|
|
11637
11646
|
var e, t;
|
|
@@ -11649,7 +11658,7 @@ var Uv = class {
|
|
|
11649
11658
|
}
|
|
11650
11659
|
get maxSize() {
|
|
11651
11660
|
var e, t;
|
|
11652
|
-
let { width: n, height: r } = (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video) == null ?
|
|
11661
|
+
let { width: n, height: r } = (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video) == null ? Sn() : e;
|
|
11653
11662
|
return {
|
|
11654
11663
|
width: n,
|
|
11655
11664
|
height: r
|
|
@@ -11663,14 +11672,14 @@ var Uv = class {
|
|
|
11663
11672
|
}
|
|
11664
11673
|
get maxVideoBitRate() {
|
|
11665
11674
|
var e, t;
|
|
11666
|
-
return (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video.bitRate) == null ?
|
|
11675
|
+
return (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.video.bitRate) == null ? xn() : e;
|
|
11667
11676
|
}
|
|
11668
11677
|
set maxVideoBitRate(e) {
|
|
11669
11678
|
this.modules.constraintCap.setUserSpecifiedCap({ video: { bitRate: e } }), this.alignSizeAndBitRate(this.targetSubscription);
|
|
11670
11679
|
}
|
|
11671
11680
|
get maxAudioBitRate() {
|
|
11672
11681
|
var e, t;
|
|
11673
|
-
return (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.audio.bitRate) == null ?
|
|
11682
|
+
return (e = (t = this.modules.constraintCap.getCurrentConstraintCap()) == null ? void 0 : t.audio.bitRate) == null ? xn() : e;
|
|
11674
11683
|
}
|
|
11675
11684
|
set maxAudioBitRate(e) {
|
|
11676
11685
|
this.modules.constraintCap.setUserSpecifiedCap({ audio: { bitRate: e } }), this.alignSizeAndBitRate(this.targetSubscription);
|
|
@@ -11784,6 +11793,6 @@ var Uv = class {
|
|
|
11784
11793
|
return t === void 0 ? this.shouldUseWebCodecs(e) : t;
|
|
11785
11794
|
}
|
|
11786
11795
|
};
|
|
11787
|
-
e(
|
|
11796
|
+
e(dy, "MAX_POOL_SIZE", 10), e(dy, "DISCONNECT_TIMEOUT", 15 * 1e3), e(dy, "REMOVE_CUE_THRESHOLD", 1e3 * 10);
|
|
11788
11797
|
//#endregion
|
|
11789
|
-
export {
|
|
11798
|
+
export { Tt as _, mt as a, yt as c, gt as d, wt as f, xt as g, _t as h, dt as i, lt as l, bt as m, sn as n, ut as o, St as p, O as r, pt as s, dy as t, ft as u, $e as v, Qe as y };
|