@vindral/web-sdk 4.5.0-7-gbf689372 → 4.5.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/{C4UNurgu.js → C02TEUyE.js} +680 -693
- package/{BRKrFfT9.js → C5AsBfiL.js} +1 -1
- package/core.js +1 -1
- package/legacy.es.js +33 -79
- package/legacy.umd.js +11 -12
- package/package.json +1 -1
- package/player.js +2 -2
- package/vindral-player-component.js +2 -2
- package/{hzC7OGw_.js → zRKuZnIT.js} +712 -758
|
@@ -938,12 +938,12 @@ var Dn = (e) => {
|
|
|
938
938
|
textPadding: 8,
|
|
939
939
|
fontSize: "28px",
|
|
940
940
|
lineGap: 16
|
|
941
|
-
}, kn = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(),
|
|
941
|
+
}, kn = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakMap(), Mn = /* @__PURE__ */ new WeakMap(), Nn = /* @__PURE__ */ new WeakSet(), Pn = class {
|
|
942
942
|
constructor() {
|
|
943
|
-
D(this,
|
|
943
|
+
D(this, Nn), C(this, kn, []), C(this, An, document.createElement("canvas")), C(this, jn, void 0), C(this, Mn, window.devicePixelRatio || 1), e(this, "config", O({}, On));
|
|
944
944
|
let t = T(An, this).getContext("2d", { alpha: !0 });
|
|
945
945
|
if (!t) throw Error("Failed to create 2d context");
|
|
946
|
-
E(
|
|
946
|
+
E(jn, this, t), w(Nn, this, In).call(this);
|
|
947
947
|
}
|
|
948
948
|
get canvas() {
|
|
949
949
|
return T(An, this);
|
|
@@ -952,9 +952,9 @@ var Dn = (e) => {
|
|
|
952
952
|
E(kn, this, e);
|
|
953
953
|
}
|
|
954
954
|
render(e, t = !1) {
|
|
955
|
-
let n = T(kn, this).flatMap((t) => t.text.split("\n").flatMap((t) => w(
|
|
956
|
-
w(
|
|
957
|
-
let t = T(
|
|
955
|
+
let n = T(kn, this).flatMap((t) => t.text.split("\n").flatMap((t) => w(Nn, this, Ln).call(this, t, e.width)).map((e) => {
|
|
956
|
+
w(Nn, this, In).call(this);
|
|
957
|
+
let t = T(jn, this).measureText(e);
|
|
958
958
|
return {
|
|
959
959
|
text: e,
|
|
960
960
|
measurement: t,
|
|
@@ -963,29 +963,24 @@ var Dn = (e) => {
|
|
|
963
963
|
width: t.width + this.config.textPadding * 2
|
|
964
964
|
}
|
|
965
965
|
};
|
|
966
|
-
}));
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
}
|
|
971
|
-
let 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;
|
|
972
|
-
w(Mn, this, Pn).call(this, r, i), T(F, this).clearRect(0, 0, T(An, this).width, T(An, this).height);
|
|
973
|
-
for (let { size: e, text: t } of n) w(Mn, this, Fn).call(this), T(F, this).fillStyle = this.config.backgroundColor, T(F, this).fillRect(0, a, e.width, e.height), w(Mn, this, Fn).call(this), T(F, this).fillText(t, this.config.textPadding, a + this.config.textPadding), a += e.height + this.config.lineGap;
|
|
974
|
-
t && (T(F, this).strokeStyle = "red", T(F, this).strokeRect(0, 0, e.width, T(An, this).height));
|
|
966
|
+
})), 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;
|
|
967
|
+
w(Nn, this, Fn).call(this, r, i), T(jn, this).clearRect(0, 0, T(An, this).width, T(An, this).height);
|
|
968
|
+
for (let { size: e, text: t } of n) w(Nn, this, In).call(this), T(jn, this).fillStyle = this.config.backgroundColor, T(jn, this).fillRect(0, a, e.width, e.height), w(Nn, this, In).call(this), T(jn, this).fillText(t, this.config.textPadding, a + this.config.textPadding), a += e.height + this.config.lineGap;
|
|
969
|
+
t && (T(jn, this).strokeStyle = "red", T(jn, this).strokeRect(0, 0, e.width, T(An, this).height));
|
|
975
970
|
}
|
|
976
971
|
};
|
|
977
|
-
function
|
|
978
|
-
T(An, this).width = e * T(
|
|
972
|
+
function Fn(e, t) {
|
|
973
|
+
T(An, this).width = e * T(Mn, this), T(An, this).height = t * T(Mn, this), T(jn, this).setTransform(T(Mn, this), 0, 0, T(Mn, this), 0, 0), this.canvas.style.width = `${e}px`, this.canvas.style.height = `${t}px`;
|
|
979
974
|
}
|
|
980
|
-
function
|
|
981
|
-
T(
|
|
975
|
+
function In() {
|
|
976
|
+
T(jn, this).fillStyle = "white", T(jn, this).textAlign = "left", T(jn, this).textBaseline = "top", T(jn, this).font = `${this.config.fontSize} sans-serif`;
|
|
982
977
|
}
|
|
983
|
-
function
|
|
978
|
+
function Ln(e, t) {
|
|
984
979
|
let n = [], r = e.split(" "), i = "";
|
|
985
980
|
for (; r.length > 0;) {
|
|
986
|
-
w(
|
|
981
|
+
w(Nn, this, In).call(this);
|
|
987
982
|
let e = 0;
|
|
988
|
-
for (; T(
|
|
983
|
+
for (; T(jn, this).measureText(i + (i.length > 0 ? " " : "") + r[0]).width + this.config.textPadding * 2 <= t && r.length > 0;) e++, i += (i.length > 0 ? " " : "") + r.shift();
|
|
989
984
|
if (e === 0) {
|
|
990
985
|
n.push(r.shift() || ""), i = "";
|
|
991
986
|
continue;
|
|
@@ -996,7 +991,7 @@ function In(e, t) {
|
|
|
996
991
|
}
|
|
997
992
|
//#endregion
|
|
998
993
|
//#region ../../libs/canvas-renderers/src/subtitleLayout.ts
|
|
999
|
-
function
|
|
994
|
+
function Rn(e) {
|
|
1000
995
|
var t;
|
|
1001
996
|
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;
|
|
1002
997
|
return {
|
|
@@ -1006,7 +1001,7 @@ function Ln(e) {
|
|
|
1006
1001
|
y: a - d - (s + c) * l
|
|
1007
1002
|
};
|
|
1008
1003
|
}
|
|
1009
|
-
function
|
|
1004
|
+
function zn(e, t, n) {
|
|
1010
1005
|
return {
|
|
1011
1006
|
scaleX: 2 * e.drawWidth / t,
|
|
1012
1007
|
scaleY: 2 * e.drawHeight / n,
|
|
@@ -1016,21 +1011,21 @@ function Rn(e, t, n) {
|
|
|
1016
1011
|
}
|
|
1017
1012
|
//#endregion
|
|
1018
1013
|
//#region ../../libs/canvas-renderers/src/canvas2d/VideoFrameCanvas2DRenderer.ts
|
|
1019
|
-
var
|
|
1014
|
+
var Bn = {
|
|
1020
1015
|
width: 256,
|
|
1021
1016
|
height: 144
|
|
1022
|
-
},
|
|
1017
|
+
}, Vn = class extends fe {
|
|
1023
1018
|
constructor() {
|
|
1024
|
-
super(), e(this, "canvas", document.createElement("canvas")), e(this, "context", null), e(this, "size",
|
|
1019
|
+
super(), e(this, "canvas", document.createElement("canvas")), e(this, "context", null), e(this, "size", Bn), e(this, "hasWarnedNoVideoFrame", !1), e(this, "subtitleRenderer", null), e(this, "hasActiveSubtitles", !1), e(this, "load", () => {
|
|
1025
1020
|
if (this.hasWarnedNoVideoFrame = !1, this.context = this.canvas.getContext("2d", {
|
|
1026
1021
|
alpha: !1,
|
|
1027
1022
|
desynchronized: !0
|
|
1028
1023
|
}), !this.context) throw Error("Failed to get 2D rendering context");
|
|
1029
|
-
this.setSize(
|
|
1024
|
+
this.setSize(Bn);
|
|
1030
1025
|
}), e(this, "unload", () => {
|
|
1031
|
-
this.context = null, this.subtitleRenderer = null, this.hasActiveSubtitles = !1, this.setSize(
|
|
1026
|
+
this.context = null, this.subtitleRenderer = null, this.hasActiveSubtitles = !1, this.setSize(Bn);
|
|
1032
1027
|
}), e(this, "setActiveCues", (e, t) => {
|
|
1033
|
-
this.subtitleRenderer || (this.subtitleRenderer = new
|
|
1028
|
+
this.subtitleRenderer || (this.subtitleRenderer = new Pn()), this.subtitleRenderer.config.fontSize = an(t.width, t.height), this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t), this.hasActiveSubtitles = e.length > 0;
|
|
1034
1029
|
}), e(this, "render", (e, t = 0) => {
|
|
1035
1030
|
if (!this.context) return;
|
|
1036
1031
|
if (!e.videoFrame) {
|
|
@@ -1051,7 +1046,7 @@ var zn = {
|
|
|
1051
1046
|
if (!this.hasActiveSubtitles || !this.subtitleRenderer || !this.context) return;
|
|
1052
1047
|
let t = this.subtitleRenderer.canvas;
|
|
1053
1048
|
if (t.width === 0 || t.height === 0) return;
|
|
1054
|
-
let n = window.devicePixelRatio || 1, r = this.canvas.clientWidth || this.canvas.width, i =
|
|
1049
|
+
let n = window.devicePixelRatio || 1, r = this.canvas.clientWidth || this.canvas.width, i = Rn({
|
|
1055
1050
|
subtitleWidth: t.width / n,
|
|
1056
1051
|
subtitleHeight: t.height / n,
|
|
1057
1052
|
canvasWidth: this.canvas.width,
|
|
@@ -1064,14 +1059,14 @@ var zn = {
|
|
|
1064
1059
|
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)));
|
|
1065
1060
|
}), Dn(this.canvas);
|
|
1066
1061
|
}
|
|
1067
|
-
},
|
|
1062
|
+
}, Hn = "\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", Un = "\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", Wn = (e, t) => {
|
|
1068
1063
|
let n = e.getContext("webgl", t);
|
|
1069
1064
|
if (n || (n = e.getContext("experimental-webgl", t)), !n) throw new y("Failed to create webgl context", {
|
|
1070
1065
|
isFatal: !0,
|
|
1071
1066
|
code: "failed_to_create_web_gl_context"
|
|
1072
1067
|
});
|
|
1073
1068
|
return n;
|
|
1074
|
-
},
|
|
1069
|
+
}, Gn = (e, t, n) => {
|
|
1075
1070
|
let r = e.createShader(t);
|
|
1076
1071
|
if (!r) throw new y("Failed to create shader", {
|
|
1077
1072
|
isFatal: !0,
|
|
@@ -1085,21 +1080,21 @@ var zn = {
|
|
|
1085
1080
|
});
|
|
1086
1081
|
}
|
|
1087
1082
|
return r;
|
|
1088
|
-
},
|
|
1083
|
+
}, Kn = (e) => {
|
|
1089
1084
|
let t = e.createTexture();
|
|
1090
1085
|
if (!t) throw new y("Failed to create texture", {
|
|
1091
1086
|
isFatal: !0,
|
|
1092
1087
|
code: "failed_to_create_texture"
|
|
1093
1088
|
});
|
|
1094
1089
|
return e.bindTexture(e.TEXTURE_2D, t), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), t;
|
|
1095
|
-
},
|
|
1090
|
+
}, qn = (e, t) => {
|
|
1096
1091
|
let n = e.createBuffer();
|
|
1097
1092
|
if (!n) throw new y("Failed to create buffer", {
|
|
1098
1093
|
isFatal: !0,
|
|
1099
1094
|
code: "failed_to_create_buffer"
|
|
1100
1095
|
});
|
|
1101
1096
|
return e.bindBuffer(e.ARRAY_BUFFER, n), e.bufferData(e.ARRAY_BUFFER, t.buffer, e.STATIC_DRAW), n;
|
|
1102
|
-
},
|
|
1097
|
+
}, Jn = (e, t, n) => {
|
|
1103
1098
|
let r = e.createProgram();
|
|
1104
1099
|
if (!r) throw new y("Failed to create program", {
|
|
1105
1100
|
isFatal: !0,
|
|
@@ -1113,9 +1108,9 @@ var zn = {
|
|
|
1113
1108
|
});
|
|
1114
1109
|
}
|
|
1115
1110
|
return r;
|
|
1116
|
-
},
|
|
1111
|
+
}, F = /* @__PURE__ */ new WeakMap(), Yn = /* @__PURE__ */ new WeakMap(), Xn = /* @__PURE__ */ new WeakMap(), Zn = /* @__PURE__ */ new WeakMap(), Qn = /* @__PURE__ */ new WeakMap(), $n = /* @__PURE__ */ new WeakSet(), er = /* @__PURE__ */ new WeakMap(), tr = class {
|
|
1117
1112
|
constructor(t) {
|
|
1118
|
-
D(this,
|
|
1113
|
+
D(this, $n), C(this, F, void 0), C(this, Yn, void 0), C(this, Xn, void 0), C(this, Zn, void 0), C(this, Qn, void 0), e(this, "subtitleRenderer", new Pn()), C(this, er, (e, t, n, r) => [
|
|
1119
1114
|
e,
|
|
1120
1115
|
0,
|
|
1121
1116
|
0,
|
|
@@ -1132,7 +1127,7 @@ var zn = {
|
|
|
1132
1127
|
r,
|
|
1133
1128
|
0,
|
|
1134
1129
|
1
|
|
1135
|
-
]), E(
|
|
1130
|
+
]), E(F, this, t), E(Yn, this, Kn(t)), E(Xn, this, Gn(t, t.FRAGMENT_SHADER, Hn)), E(Zn, this, Gn(t, t.VERTEX_SHADER, Un)), E(Qn, this, Jn(t, T(Zn, this), T(Xn, this)));
|
|
1136
1131
|
}
|
|
1137
1132
|
setActiveCues(e, t) {
|
|
1138
1133
|
this.subtitleRenderer.config.fontSize = an(t.width, t.height), this.subtitleRenderer.setActiveCues(e), this.subtitleRenderer.render(t);
|
|
@@ -1140,7 +1135,7 @@ var zn = {
|
|
|
1140
1135
|
render(e) {
|
|
1141
1136
|
let t = this.subtitleRenderer.canvas;
|
|
1142
1137
|
if (t.width === 0) return;
|
|
1143
|
-
let n = window.devicePixelRatio || 1, r = Rn(
|
|
1138
|
+
let n = window.devicePixelRatio || 1, r = zn(Rn({
|
|
1144
1139
|
subtitleWidth: t.width / n,
|
|
1145
1140
|
subtitleHeight: t.height / n,
|
|
1146
1141
|
canvasWidth: e.canvasWidth,
|
|
@@ -1148,49 +1143,49 @@ var zn = {
|
|
|
1148
1143
|
containerWidth: e.containerWidth,
|
|
1149
1144
|
bottomPadding: e.bottomPadding
|
|
1150
1145
|
}), e.canvasWidth, e.canvasHeight);
|
|
1151
|
-
T(
|
|
1146
|
+
T(F, this).useProgram(T(Qn, this)), w($n, this, nr).call(this), w($n, this, rr).call(this, r.scaleX, r.scaleY, r.translateX, r.translateY), T(F, this).uniform1i(T(F, this).getUniformLocation(T(Qn, this), "texture"), 4), T(F, this).activeTexture(T(F, this).TEXTURE4), T(F, this).bindTexture(T(F, this).TEXTURE_2D, T(Yn, this)), T(F, this).enable(T(F, this).BLEND), T(F, this).blendFunc(T(F, this).SRC_ALPHA, T(F, this).ONE_MINUS_SRC_ALPHA), T(F, this).texImage2D(T(F, this).TEXTURE_2D, 0, T(F, this).RGBA, T(F, this).RGBA, T(F, this).UNSIGNED_BYTE, t), T(F, this).texParameteri(T(F, this).TEXTURE_2D, T(F, this).TEXTURE_MAG_FILTER, T(F, this).LINEAR), T(F, this).drawArrays(T(F, this).TRIANGLE_STRIP, 0, 4);
|
|
1152
1147
|
}
|
|
1153
1148
|
};
|
|
1154
|
-
function
|
|
1155
|
-
let e = T(
|
|
1156
|
-
T(
|
|
1149
|
+
function nr() {
|
|
1150
|
+
let e = T(F, this).getAttribLocation(T(Qn, this), "position");
|
|
1151
|
+
T(F, this).enableVertexAttribArray(e), T(F, this).vertexAttribPointer(e, 2, T(F, this).FLOAT, !1, 0, 0);
|
|
1157
1152
|
}
|
|
1158
|
-
function
|
|
1159
|
-
let i = T(
|
|
1160
|
-
T(
|
|
1153
|
+
function rr(e, t, n, r) {
|
|
1154
|
+
let i = T(F, this).getUniformLocation(T(Qn, this), "model");
|
|
1155
|
+
T(F, this).uniformMatrix4fv(i, !1, T(er, this).call(this, e, t, n, r));
|
|
1161
1156
|
}
|
|
1162
1157
|
//#endregion
|
|
1163
1158
|
//#region ../../libs/canvas-renderers/src/webgl/video-shaders/PixelShader.ts
|
|
1164
|
-
var
|
|
1159
|
+
var ir = "\nprecision mediump float;\nuniform sampler2D y_texture;\nuniform sampler2D u_texture;\nuniform sampler2D v_texture;\nuniform mat4 conversion;\n\nvarying vec2 texture_coordinate;\n\nvoid main() {\n float y = texture2D(y_texture, texture_coordinate).r;\n float u = texture2D(u_texture, texture_coordinate).r;\n float v = texture2D(v_texture, texture_coordinate).r;\n\n gl_FragColor = vec4(y, u, v, 1) * conversion;\n}\n", ar = "\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", or = {
|
|
1165
1160
|
width: 256,
|
|
1166
1161
|
codedWidth: 256,
|
|
1167
1162
|
height: 144,
|
|
1168
1163
|
codedHeight: 144
|
|
1169
|
-
},
|
|
1164
|
+
}, sr = {
|
|
1170
1165
|
preserveDrawingBuffer: !1,
|
|
1171
1166
|
alpha: !1,
|
|
1172
1167
|
depth: !1,
|
|
1173
1168
|
stencil: !1,
|
|
1174
1169
|
antialias: !1,
|
|
1175
1170
|
premultipliedAlpha: !1
|
|
1176
|
-
},
|
|
1171
|
+
}, cr = class t extends fe {
|
|
1177
1172
|
constructor() {
|
|
1178
|
-
super(), e(this, "canvas", document.createElement("canvas")), e(this, "context",
|
|
1179
|
-
y:
|
|
1180
|
-
u:
|
|
1181
|
-
v:
|
|
1182
|
-
}), e(this, "textRenderer", void 0), e(this, "size",
|
|
1173
|
+
super(), e(this, "canvas", document.createElement("canvas")), e(this, "context", Wn(this.canvas, sr)), e(this, "pixelShader", Gn(this.context, this.context.FRAGMENT_SHADER, ir)), e(this, "vertexShader", Gn(this.context, this.context.VERTEX_SHADER, ar)), e(this, "buffer", qn(this.context, t.SQUARE_VERTICES)), e(this, "program", Jn(this.context, this.vertexShader, this.pixelShader)), e(this, "textures", {
|
|
1174
|
+
y: Kn(this.context),
|
|
1175
|
+
u: Kn(this.context),
|
|
1176
|
+
v: Kn(this.context)
|
|
1177
|
+
}), e(this, "textRenderer", void 0), e(this, "size", or), e(this, "modelLocation", null), e(this, "conversionLocation", null), e(this, "cachedScaleX", 0), e(this, "cachedScaleY", 0), e(this, "cachedTransformMatrix", null), e(this, "texturesNeedRealloc", !0), e(this, "onContextLost", (e) => {
|
|
1183
1178
|
this.textRenderer = void 0;
|
|
1184
1179
|
let t = Error(e instanceof WebGLContextEvent ? e.statusMessage : "webgl context lost");
|
|
1185
1180
|
this.emit("context lost", g(t)), e.preventDefault();
|
|
1186
1181
|
}), e(this, "onContextRestored", () => {
|
|
1187
|
-
this.emit("context restored"), this.context =
|
|
1188
|
-
y:
|
|
1189
|
-
u:
|
|
1190
|
-
v:
|
|
1182
|
+
this.emit("context restored"), this.context = Wn(this.canvas, sr), this.pixelShader = Gn(this.context, this.context.FRAGMENT_SHADER, ir), this.vertexShader = Gn(this.context, this.context.VERTEX_SHADER, ar), this.buffer = qn(this.context, t.SQUARE_VERTICES), this.program = Jn(this.context, this.vertexShader, this.pixelShader), this.textures = {
|
|
1183
|
+
y: Kn(this.context),
|
|
1184
|
+
u: Kn(this.context),
|
|
1185
|
+
v: Kn(this.context)
|
|
1191
1186
|
}, this.load();
|
|
1192
1187
|
}), e(this, "load", () => {
|
|
1193
|
-
this.context.useProgram(this.program), this.setupPositionVertexAttributes(), this.texturesNeedRealloc = !0, this.setSize(
|
|
1188
|
+
this.context.useProgram(this.program), this.setupPositionVertexAttributes(), this.texturesNeedRealloc = !0, this.setSize(or), this.modelLocation = this.context.getUniformLocation(this.program, "model"), this.conversionLocation = this.context.getUniformLocation(this.program, "conversion"), 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(t.REC709);
|
|
1194
1189
|
}), e(this, "unload", () => {
|
|
1195
1190
|
var e;
|
|
1196
1191
|
this.setSize({
|
|
@@ -1257,10 +1252,10 @@ var rr = "\nprecision mediump float;\nuniform sampler2D y_texture;\nuniform samp
|
|
|
1257
1252
|
]), this.canvas.addEventListener("webglcontextlost", this.onContextLost), this.canvas.addEventListener("webglcontextrestored", this.onContextRestored, !1), Dn(this.canvas);
|
|
1258
1253
|
}
|
|
1259
1254
|
getTextRenderer() {
|
|
1260
|
-
return this.textRenderer || (this.textRenderer = new
|
|
1255
|
+
return this.textRenderer || (this.textRenderer = new tr(this.context)), this.textRenderer;
|
|
1261
1256
|
}
|
|
1262
1257
|
};
|
|
1263
|
-
e(
|
|
1258
|
+
e(cr, "SQUARE_VERTICES", new Float32Array([
|
|
1264
1259
|
0,
|
|
1265
1260
|
0,
|
|
1266
1261
|
0,
|
|
@@ -1269,7 +1264,7 @@ e(sr, "SQUARE_VERTICES", new Float32Array([
|
|
|
1269
1264
|
0,
|
|
1270
1265
|
1,
|
|
1271
1266
|
1
|
|
1272
|
-
])), e(
|
|
1267
|
+
])), e(cr, "REC709", [
|
|
1273
1268
|
1.16438,
|
|
1274
1269
|
0,
|
|
1275
1270
|
1.79274,
|
|
@@ -1286,7 +1281,7 @@ e(sr, "SQUARE_VERTICES", new Float32Array([
|
|
|
1286
1281
|
0,
|
|
1287
1282
|
0,
|
|
1288
1283
|
1
|
|
1289
|
-
]), e(
|
|
1284
|
+
]), e(cr, "REC601", [
|
|
1290
1285
|
1.16438,
|
|
1291
1286
|
0,
|
|
1292
1287
|
1.59603,
|
|
@@ -1306,21 +1301,21 @@ e(sr, "SQUARE_VERTICES", new Float32Array([
|
|
|
1306
1301
|
]);
|
|
1307
1302
|
//#endregion
|
|
1308
1303
|
//#region ../../libs/eme/src/CdmManager.ts
|
|
1309
|
-
var
|
|
1304
|
+
var lr = /* @__PURE__ */ new WeakMap(), ur = /* @__PURE__ */ new WeakMap(), dr = class {
|
|
1310
1305
|
constructor(t, n, r, i) {
|
|
1311
|
-
e(this, "keySystem", void 0), e(this, "licenseServerUrl", void 0), e(this, "certificate", void 0), e(this, "headers", {}), e(this, "queryParams", {}), C(this,
|
|
1306
|
+
e(this, "keySystem", void 0), e(this, "licenseServerUrl", void 0), e(this, "certificate", void 0), e(this, "headers", {}), e(this, "queryParams", {}), C(this, lr, void 0), C(this, ur, void 0), E(lr, this, n), this.keySystem = t, this.licenseServerUrl = r, this.certificate = i;
|
|
1312
1307
|
}
|
|
1313
1308
|
get statistics() {
|
|
1314
1309
|
return {
|
|
1315
|
-
keySystem: T(
|
|
1310
|
+
keySystem: T(lr, this).keySystem,
|
|
1316
1311
|
licenseServerUrl: this.licenseServerUrl,
|
|
1317
|
-
mediaKeySystemConfiguration: T(
|
|
1312
|
+
mediaKeySystemConfiguration: T(lr, this).getConfiguration()
|
|
1318
1313
|
};
|
|
1319
1314
|
}
|
|
1320
1315
|
getMediaKeys() {
|
|
1321
1316
|
var e = this;
|
|
1322
1317
|
return t(function* () {
|
|
1323
|
-
return T(
|
|
1318
|
+
return T(ur, e) || E(ur, e, yield T(lr, e).createMediaKeys()), T(ur, e);
|
|
1324
1319
|
})();
|
|
1325
1320
|
}
|
|
1326
1321
|
requestLicense(e) {
|
|
@@ -1340,17 +1335,17 @@ var cr = /* @__PURE__ */ new WeakMap(), lr = /* @__PURE__ */ new WeakMap(), ur =
|
|
|
1340
1335
|
};
|
|
1341
1336
|
//#endregion
|
|
1342
1337
|
//#region ../../libs/eme/src/emeUtils.ts
|
|
1343
|
-
function
|
|
1338
|
+
function fr(e) {
|
|
1344
1339
|
let t = window.atob(e.replace(/-/g, "+").replace(/_/g, "/")), n = "";
|
|
1345
1340
|
for (let e = 0; e < t.length; e++) n += `0${t.charCodeAt(e).toString(16)}`.substr(-2);
|
|
1346
1341
|
return n;
|
|
1347
1342
|
}
|
|
1348
|
-
function
|
|
1343
|
+
function pr(e) {
|
|
1349
1344
|
let t = "";
|
|
1350
1345
|
for (let n = 0; n < e.length; n += 2) t += String.fromCharCode(parseInt(e.substr(n, 2), 16));
|
|
1351
1346
|
return window.btoa(t).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
1352
1347
|
}
|
|
1353
|
-
function
|
|
1348
|
+
function mr(e, t) {
|
|
1354
1349
|
if (e.byteLength !== t.byteLength) return !1;
|
|
1355
1350
|
let n = new Uint8Array(e), r = new Uint8Array(t);
|
|
1356
1351
|
for (let e = 0; e < n.length; e++) if (n[e] !== r[e]) return !1;
|
|
@@ -1358,21 +1353,21 @@ function pr(e, t) {
|
|
|
1358
1353
|
}
|
|
1359
1354
|
//#endregion
|
|
1360
1355
|
//#region ../../libs/eme/src/Clearkey.ts
|
|
1361
|
-
var
|
|
1356
|
+
var hr = /* @__PURE__ */ new WeakMap(), gr = class extends dr {
|
|
1362
1357
|
constructor(e, t) {
|
|
1363
|
-
super("clearkey", e, ""), C(this,
|
|
1358
|
+
super("clearkey", e, ""), C(this, hr, void 0), E(hr, this, t);
|
|
1364
1359
|
}
|
|
1365
1360
|
handleLicenseRequest(e) {
|
|
1366
1361
|
let t = new Uint8Array(e), n = String.fromCharCode(...t), r = JSON.parse(n), i = [];
|
|
1367
1362
|
for (let e = 0; e < r.kids.length; e++) {
|
|
1368
1363
|
let t = r.kids[e];
|
|
1369
1364
|
if (t) {
|
|
1370
|
-
let e =
|
|
1365
|
+
let e = fr(t).toLowerCase(), n = T(hr, this)[e];
|
|
1371
1366
|
n && i.push({
|
|
1372
1367
|
kty: "oct",
|
|
1373
1368
|
alg: "A128KW",
|
|
1374
1369
|
kid: t,
|
|
1375
|
-
k:
|
|
1370
|
+
k: pr(n)
|
|
1376
1371
|
});
|
|
1377
1372
|
}
|
|
1378
1373
|
}
|
|
@@ -1382,7 +1377,7 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1382
1377
|
});
|
|
1383
1378
|
return new TextEncoder().encode(a);
|
|
1384
1379
|
}
|
|
1385
|
-
},
|
|
1380
|
+
}, _r = {
|
|
1386
1381
|
playready: [
|
|
1387
1382
|
"150",
|
|
1388
1383
|
"2000",
|
|
@@ -1397,11 +1392,11 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1397
1392
|
],
|
|
1398
1393
|
fairplay: [""],
|
|
1399
1394
|
clearkey: [""]
|
|
1400
|
-
},
|
|
1395
|
+
}, vr = {
|
|
1401
1396
|
initDataTypes: ["cenc"],
|
|
1402
1397
|
audioCapabilities: [{ contentType: "audio/mp4; codecs=\"mp4a.40.2\"" }],
|
|
1403
1398
|
videoCapabilities: [{ contentType: "video/mp4; codecs=\"avc1.42c01f\"" }]
|
|
1404
|
-
},
|
|
1399
|
+
}, yr = {
|
|
1405
1400
|
fairplay: {
|
|
1406
1401
|
keySystem: "com.apple.fps",
|
|
1407
1402
|
supportedConfig: {
|
|
@@ -1411,24 +1406,24 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1411
1406
|
},
|
|
1412
1407
|
playready: {
|
|
1413
1408
|
keySystem: "com.microsoft.playready",
|
|
1414
|
-
supportedConfig:
|
|
1409
|
+
supportedConfig: vr
|
|
1415
1410
|
},
|
|
1416
1411
|
widevine: {
|
|
1417
1412
|
keySystem: "com.widevine.alpha",
|
|
1418
|
-
supportedConfig:
|
|
1413
|
+
supportedConfig: vr
|
|
1419
1414
|
},
|
|
1420
1415
|
clearkey: {
|
|
1421
1416
|
keySystem: "org.w3.clearkey",
|
|
1422
|
-
supportedConfig:
|
|
1417
|
+
supportedConfig: vr
|
|
1423
1418
|
}
|
|
1424
|
-
},
|
|
1419
|
+
}, br = function() {
|
|
1425
1420
|
var e = t(function* (e, t) {
|
|
1426
1421
|
return navigator.requestMediaKeySystemAccess(e, [t]).catch(() => void 0);
|
|
1427
1422
|
});
|
|
1428
1423
|
return function(t, n) {
|
|
1429
1424
|
return e.apply(this, arguments);
|
|
1430
1425
|
};
|
|
1431
|
-
}(),
|
|
1426
|
+
}(), xr = function() {
|
|
1432
1427
|
var e = t(function* (e, t, n, r, i, a) {
|
|
1433
1428
|
let o;
|
|
1434
1429
|
for (let s of r) {
|
|
@@ -1436,7 +1431,7 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1436
1431
|
robustness: s,
|
|
1437
1432
|
contentType: a ? `${i === "audioCapabilities" ? "audio/mp4" : "video/mp4"}; codecs="${a}"` : e.contentType
|
|
1438
1433
|
}));
|
|
1439
|
-
if (!(yield
|
|
1434
|
+
if (!(yield br(e, {
|
|
1440
1435
|
initDataTypes: t,
|
|
1441
1436
|
[i]: r
|
|
1442
1437
|
}))) break;
|
|
@@ -1447,10 +1442,10 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1447
1442
|
return function(t, n, r, i, a, o) {
|
|
1448
1443
|
return e.apply(this, arguments);
|
|
1449
1444
|
};
|
|
1450
|
-
}(),
|
|
1445
|
+
}(), Sr = function() {
|
|
1451
1446
|
var e = t(function* (e, t, n, r) {
|
|
1452
|
-
let { keySystem: i, supportedConfig: a } =
|
|
1453
|
-
if (!(!f && !p)) return yield
|
|
1447
|
+
let { keySystem: i, supportedConfig: a } = yr[e], { initDataTypes: o, videoCapabilities: s, audioCapabilities: c } = a, l = r == null ? void 0 : r[e], u = (l == null ? void 0 : l.videoRobustness) || _r[e], d = (l == null ? void 0 : l.audioRobustness) || _r[e], [f, p] = yield Promise.all([xr(i, o, s, u, "videoCapabilities", t), xr(i, o, c, d, "audioCapabilities", n)]);
|
|
1448
|
+
if (!(!f && !p)) return yield br(i, {
|
|
1454
1449
|
initDataTypes: o,
|
|
1455
1450
|
videoCapabilities: f,
|
|
1456
1451
|
audioCapabilities: p
|
|
@@ -1459,10 +1454,10 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1459
1454
|
return function(t, n, r, i) {
|
|
1460
1455
|
return e.apply(this, arguments);
|
|
1461
1456
|
};
|
|
1462
|
-
}(),
|
|
1457
|
+
}(), Cr = function() {
|
|
1463
1458
|
var e = t(function* (e, t, n, r) {
|
|
1464
1459
|
let i;
|
|
1465
|
-
for (let a of e) if (i = yield
|
|
1460
|
+
for (let a of e) if (i = yield Sr(a, t, n, r), i) return {
|
|
1466
1461
|
keySystem: a,
|
|
1467
1462
|
mediaKeySystemAccess: i
|
|
1468
1463
|
};
|
|
@@ -1470,11 +1465,11 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1470
1465
|
return function(t, n, r, i) {
|
|
1471
1466
|
return e.apply(this, arguments);
|
|
1472
1467
|
};
|
|
1473
|
-
}(),
|
|
1468
|
+
}(), wr = class extends dr {
|
|
1474
1469
|
constructor(e, t, n) {
|
|
1475
1470
|
super("fairplay", e, t, n);
|
|
1476
1471
|
}
|
|
1477
|
-
},
|
|
1472
|
+
}, Tr = (e) => {
|
|
1478
1473
|
var t;
|
|
1479
1474
|
let n = String.fromCharCode(...new Uint16Array(e)), r = new window.DOMParser().parseFromString(n, "application/xml"), i = r.getElementsByTagName("HttpHeaders")[0], a = {};
|
|
1480
1475
|
if (i) {
|
|
@@ -1497,7 +1492,7 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1497
1492
|
headers: a,
|
|
1498
1493
|
message: l
|
|
1499
1494
|
};
|
|
1500
|
-
},
|
|
1495
|
+
}, Er = class extends dr {
|
|
1501
1496
|
constructor(e, t) {
|
|
1502
1497
|
super("playready", e, t);
|
|
1503
1498
|
}
|
|
@@ -1507,7 +1502,7 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1507
1502
|
oe(n.licenseServerUrl, "No license server URL set");
|
|
1508
1503
|
let t = new URL(n.licenseServerUrl);
|
|
1509
1504
|
for (let [e, r] of Object.entries(n.queryParams)) t.searchParams.append(e, r);
|
|
1510
|
-
let r =
|
|
1505
|
+
let r = Tr(e), i = yield fetch(t, {
|
|
1511
1506
|
method: "POST",
|
|
1512
1507
|
headers: O(O({}, r.headers), n.headers),
|
|
1513
1508
|
body: r.message
|
|
@@ -1516,118 +1511,118 @@ var mr = /* @__PURE__ */ new WeakMap(), hr = class extends ur {
|
|
|
1516
1511
|
return yield i.arrayBuffer();
|
|
1517
1512
|
})();
|
|
1518
1513
|
}
|
|
1519
|
-
},
|
|
1514
|
+
}, Dr = class extends dr {
|
|
1520
1515
|
constructor(e, t) {
|
|
1521
1516
|
super("widevine", e, t);
|
|
1522
1517
|
}
|
|
1523
|
-
},
|
|
1518
|
+
}, Or = 5e3, I = /* @__PURE__ */ new WeakMap(), kr = /* @__PURE__ */ new WeakMap(), Ar = /* @__PURE__ */ new WeakMap(), jr = /* @__PURE__ */ new WeakMap(), Mr = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), Nr = /* @__PURE__ */ new WeakMap(), Pr = /* @__PURE__ */ new WeakMap(), Fr = /* @__PURE__ */ new WeakMap(), Ir = /* @__PURE__ */ new WeakMap(), Lr = /* @__PURE__ */ new WeakMap(), Rr = /* @__PURE__ */ new WeakMap(), zr = /* @__PURE__ */ new WeakSet(), Br = /* @__PURE__ */ new WeakMap(), Vr = /* @__PURE__ */ new WeakMap(), Hr = /* @__PURE__ */ new WeakMap(), Ur = class {
|
|
1524
1519
|
constructor(e, n, r = {}) {
|
|
1525
1520
|
var i = this;
|
|
1526
|
-
D(this,
|
|
1527
|
-
if (T(
|
|
1528
|
-
let t = w(
|
|
1529
|
-
t && (T(
|
|
1530
|
-
}
|
|
1531
|
-
T(
|
|
1532
|
-
}), C(this,
|
|
1533
|
-
T(
|
|
1534
|
-
}), C(this,
|
|
1521
|
+
D(this, zr), C(this, I, void 0), C(this, kr, void 0), C(this, Ar, void 0), C(this, jr, new k()), C(this, Mr, void 0), C(this, L, void 0), C(this, Nr, /* @__PURE__ */ new Map()), C(this, Pr, void 0), C(this, Fr, $e()), C(this, Ir, void 0), C(this, Lr, (e) => {
|
|
1522
|
+
if (T(I, this).info("Received DRM data", { drmData: e }), window.clearTimeout(T(Ir, this)), T(L, this)) {
|
|
1523
|
+
let t = w(zr, this, Zr).call(this, e)[T(L, this).keySystem];
|
|
1524
|
+
t && (T(L, this).licenseServerUrl = t);
|
|
1525
|
+
}
|
|
1526
|
+
T(jr, this).resolve(e);
|
|
1527
|
+
}), C(this, Rr, (e) => {
|
|
1528
|
+
T(I, this).info("Encrypted event received", { event: e }), w(zr, this, Wr).call(this, e);
|
|
1529
|
+
}), C(this, Br, (e) => {
|
|
1535
1530
|
var t, n;
|
|
1536
|
-
T(
|
|
1531
|
+
T(I, this).debug("Session message received", { event: e });
|
|
1537
1532
|
let r = e.target, i = e.message;
|
|
1538
|
-
if (!T(
|
|
1539
|
-
T(
|
|
1533
|
+
if (!T(Nr, this).get(r)) {
|
|
1534
|
+
T(I, this).error("No active session found for event", { event: e });
|
|
1540
1535
|
return;
|
|
1541
1536
|
}
|
|
1542
|
-
T(
|
|
1537
|
+
T(I, this).debug("Requesting license for session", {
|
|
1543
1538
|
sessionId: r.sessionId,
|
|
1544
|
-
licenseServerUrl: (t = T(
|
|
1545
|
-
}), (n = T(
|
|
1546
|
-
T(
|
|
1547
|
-
w(
|
|
1539
|
+
licenseServerUrl: (t = T(L, this)) == null ? void 0 : t.licenseServerUrl
|
|
1540
|
+
}), (n = T(L, this)) == null || n.requestLicense(i).then((e) => {
|
|
1541
|
+
T(I, this).debug("License received for session", { sessionId: r.sessionId }), r.update(e).catch((e) => {
|
|
1542
|
+
w(zr, this, Yr).call(this, {
|
|
1548
1543
|
message: "Failed to update session with license",
|
|
1549
1544
|
isFatal: !1,
|
|
1550
1545
|
error: e
|
|
1551
1546
|
});
|
|
1552
1547
|
});
|
|
1553
1548
|
}).catch((e) => {
|
|
1554
|
-
w(
|
|
1549
|
+
w(zr, this, Yr).call(this, {
|
|
1555
1550
|
message: "Failed to request license",
|
|
1556
1551
|
isFatal: !1,
|
|
1557
1552
|
error: e
|
|
1558
1553
|
});
|
|
1559
1554
|
});
|
|
1560
|
-
}), C(this,
|
|
1555
|
+
}), C(this, Vr, (e) => {
|
|
1561
1556
|
let t = e.target;
|
|
1562
|
-
T(
|
|
1563
|
-
let n =
|
|
1564
|
-
T(
|
|
1557
|
+
T(I, this).debug("Key status changed for session", { sessionId: t.sessionId }), t.keyStatuses.forEach((e, t) => {
|
|
1558
|
+
let n = fr(window.btoa(String.fromCharCode(...new Uint8Array(t))));
|
|
1559
|
+
T(I, this).debug("Key status", {
|
|
1565
1560
|
base64kid: n,
|
|
1566
1561
|
status: e
|
|
1567
1562
|
});
|
|
1568
1563
|
});
|
|
1569
|
-
}), C(this,
|
|
1564
|
+
}), C(this, Hr, function() {
|
|
1570
1565
|
var e = t(function* (e) {
|
|
1571
|
-
let t = w(
|
|
1572
|
-
T(
|
|
1573
|
-
let n = yield
|
|
1574
|
-
widevine: T(
|
|
1575
|
-
playready: T(
|
|
1566
|
+
let t = w(zr, i, Xr).call(i, e);
|
|
1567
|
+
T(I, i).debug("Prioritized key system list", { keySystemList: t });
|
|
1568
|
+
let n = yield Cr(t, e.videoCodec, e.audioCodec, {
|
|
1569
|
+
widevine: T(Mr, i).widevine,
|
|
1570
|
+
playready: T(Mr, i).playready
|
|
1576
1571
|
});
|
|
1577
|
-
if (!n) return T(
|
|
1578
|
-
T(
|
|
1572
|
+
if (!n) return T(I, i).warn("No supported key system found"), null;
|
|
1573
|
+
T(I, i).debug("Supported key system found", n.mediaKeySystemAccess.getConfiguration());
|
|
1579
1574
|
let { keySystem: r, mediaKeySystemAccess: a } = n, o = null;
|
|
1580
|
-
return r === "clearkey" ? (oe(e.clearkeys, "No clearkeys found"), o = new
|
|
1575
|
+
return r === "clearkey" ? (oe(e.clearkeys, "No clearkeys found"), o = new gr(a, e.clearkeys)) : r === "playready" ? (oe(e.playreadyLicenseUrl, "No playreadyLicenseUrl found"), o = new Er(a, e.playreadyLicenseUrl)) : r === "widevine" ? (oe(e.widevineLicenseUrl, "No widevineLicenseUrl found"), o = new Dr(a, e.widevineLicenseUrl)) : r === "fairplay" && (oe(e.fairplayLicenseUrl, "No fairplayLicenseUrl found"), oe(e.fairplayCertificate, "No fairplayCertificate found"), o = new wr(a, e.fairplayLicenseUrl, e.fairplayCertificate)), o && (o.headers = T(Mr, i).headers || {}, o.queryParams = T(Mr, i).queryParams || {}), o;
|
|
1581
1576
|
});
|
|
1582
1577
|
return function(t) {
|
|
1583
1578
|
return e.apply(this, arguments);
|
|
1584
1579
|
};
|
|
1585
|
-
}()), E(
|
|
1580
|
+
}()), E(kr, this, e), E(I, this, n), E(Mr, this, r), T(kr, this).on("received drm data", T(Lr, this));
|
|
1586
1581
|
}
|
|
1587
1582
|
static isSupported() {
|
|
1588
1583
|
return !!navigator.requestMediaKeySystemAccess;
|
|
1589
1584
|
}
|
|
1590
1585
|
attach(e) {
|
|
1591
|
-
E(
|
|
1586
|
+
E(Ar, this, e), T(I, this).info("Media element attached"), T(Ar, this).addEventListener("encrypted", T(Rr, this));
|
|
1592
1587
|
}
|
|
1593
1588
|
getStatistics() {
|
|
1594
1589
|
var e, t;
|
|
1595
|
-
return !T(
|
|
1590
|
+
return !T(jr, this).resolved && !((e = T(L, this)) != null && e.statistics) ? null : O(O({}, T(jr, this).resolved), (t = T(L, this)) == null ? void 0 : t.statistics);
|
|
1596
1591
|
}
|
|
1597
1592
|
unload() {
|
|
1598
1593
|
var e;
|
|
1599
|
-
T(
|
|
1594
|
+
T(I, this).info("Unloading EncryptedMediaExtensions"), T(kr, this).off("received drm data", T(Lr, this)), (e = T(Ar, this)) == null || e.removeEventListener("encrypted", T(Rr, this)), T(Nr, this).forEach((e, t) => {
|
|
1600
1595
|
t.close();
|
|
1601
|
-
}), T(
|
|
1596
|
+
}), T(Nr, this).clear(), E(Pr, this, void 0), E(L, this, void 0);
|
|
1602
1597
|
}
|
|
1603
1598
|
set headers(e) {
|
|
1604
|
-
T(
|
|
1599
|
+
T(Mr, this).headers = e, T(L, this) && (T(L, this).headers = e);
|
|
1605
1600
|
}
|
|
1606
1601
|
set queryParams(e) {
|
|
1607
|
-
T(
|
|
1602
|
+
T(Mr, this).queryParams = e, T(L, this) && (T(L, this).queryParams = e);
|
|
1608
1603
|
}
|
|
1609
1604
|
onChannelSwitch() {
|
|
1610
|
-
if (!T(
|
|
1611
|
-
T(
|
|
1605
|
+
if (!T(jr, this).resolved) {
|
|
1606
|
+
T(I, this).debug("DRM is not used, skipping channel switch handling");
|
|
1612
1607
|
return;
|
|
1613
1608
|
}
|
|
1614
|
-
Ye() && T(
|
|
1609
|
+
Ye() && T(Fr, this).platform.safariVersion < 18 && w(zr, this, Yr).call(this, {
|
|
1615
1610
|
message: "DRM channel switch not supported on Safari < 18",
|
|
1616
1611
|
isFatal: !0
|
|
1617
|
-
}), window.clearTimeout(T(
|
|
1618
|
-
let e = T(
|
|
1619
|
-
E(
|
|
1620
|
-
T(
|
|
1621
|
-
},
|
|
1612
|
+
}), window.clearTimeout(T(Ir, this));
|
|
1613
|
+
let e = T(jr, this).resolved;
|
|
1614
|
+
E(jr, this, new k()), E(Ir, this, window.setTimeout(() => {
|
|
1615
|
+
T(jr, this).resolve(e);
|
|
1616
|
+
}, Or));
|
|
1622
1617
|
}
|
|
1623
1618
|
};
|
|
1624
|
-
function
|
|
1619
|
+
function Wr(e) {
|
|
1625
1620
|
var n = this;
|
|
1626
1621
|
return t(function* () {
|
|
1627
1622
|
try {
|
|
1628
|
-
yield w(
|
|
1623
|
+
yield w(zr, n, Gr).call(n), T(I, n).debug("Media keys initialization completed"), yield w(zr, n, Kr).call(n, e.initData, e.initDataType);
|
|
1629
1624
|
} catch (e) {
|
|
1630
|
-
w(
|
|
1625
|
+
w(zr, n, Yr).call(n, {
|
|
1631
1626
|
message: "Failed to handle encrypted event",
|
|
1632
1627
|
isFatal: !0,
|
|
1633
1628
|
error: e
|
|
@@ -1635,70 +1630,70 @@ function Ur(e) {
|
|
|
1635
1630
|
}
|
|
1636
1631
|
})();
|
|
1637
1632
|
}
|
|
1638
|
-
function
|
|
1633
|
+
function Gr() {
|
|
1639
1634
|
var e = this;
|
|
1640
1635
|
return t(function* () {
|
|
1641
1636
|
var n;
|
|
1642
|
-
T(
|
|
1643
|
-
let r = yield T(
|
|
1644
|
-
if ((n = T(
|
|
1645
|
-
T(
|
|
1637
|
+
T(I, e).debug("Initializing media keys");
|
|
1638
|
+
let r = yield T(jr, e).promise;
|
|
1639
|
+
if ((n = T(Ar, e)) != null && n.mediaKeys) {
|
|
1640
|
+
T(I, e).debug("Media keys already set on media element");
|
|
1646
1641
|
return;
|
|
1647
1642
|
}
|
|
1648
|
-
if (T(
|
|
1649
|
-
T(
|
|
1643
|
+
if (T(Pr, e)) {
|
|
1644
|
+
T(I, e).debug("Media keys initialization already in progress, waiting for completion"), yield T(Pr, e);
|
|
1650
1645
|
return;
|
|
1651
1646
|
}
|
|
1652
|
-
E(
|
|
1653
|
-
let t = yield T(
|
|
1654
|
-
T(
|
|
1647
|
+
E(Pr, e, t(function* () {
|
|
1648
|
+
let t = yield T(Hr, e).call(e, r);
|
|
1649
|
+
T(I, e).debug("CDM obtained", { cdm: t }), oe(T(Ar, e), "No media element found"), oe(t, "No CDM found");
|
|
1655
1650
|
let n = yield t.getMediaKeys();
|
|
1656
|
-
t.certificate && (yield w(
|
|
1657
|
-
})()), yield T(
|
|
1651
|
+
t.certificate && (yield w(zr, e, Jr).call(e, n, t.certificate)), T(I, e).debug("Setting media keys on media element"), yield T(Ar, e).setMediaKeys(n), E(L, e, t);
|
|
1652
|
+
})()), yield T(Pr, e);
|
|
1658
1653
|
})();
|
|
1659
1654
|
}
|
|
1660
|
-
function
|
|
1655
|
+
function Kr(e, n) {
|
|
1661
1656
|
var r = this;
|
|
1662
1657
|
return t(function* () {
|
|
1663
|
-
oe(T(
|
|
1664
|
-
let t = yield T(
|
|
1665
|
-
if (!e || !w(
|
|
1666
|
-
T(
|
|
1658
|
+
oe(T(L, r), "No CDM manager found");
|
|
1659
|
+
let t = yield T(L, r).getMediaKeys();
|
|
1660
|
+
if (!e || !w(zr, r, qr).call(r, e)) {
|
|
1661
|
+
T(I, r).debug("Duplicate initData, no need to create new session", { initData: e });
|
|
1667
1662
|
return;
|
|
1668
1663
|
}
|
|
1669
1664
|
let i = t.createSession();
|
|
1670
|
-
T(
|
|
1671
|
-
T(
|
|
1672
|
-
}), i.addEventListener("message", T(
|
|
1665
|
+
T(I, r).debug("Creating new session", { session: i }), i.addEventListener("keystatuseschange", T(Vr, r)), i.closed.then((e) => {
|
|
1666
|
+
T(I, r).info("Session is closed", { reason: e });
|
|
1667
|
+
}), i.addEventListener("message", T(Br, r)), T(Nr, r).set(i, e), T(I, r).debug("Generating request for session", {
|
|
1673
1668
|
session: i,
|
|
1674
1669
|
initDataType: n,
|
|
1675
1670
|
initData: e
|
|
1676
1671
|
}), yield i.generateRequest(n, e);
|
|
1677
1672
|
})();
|
|
1678
1673
|
}
|
|
1679
|
-
function
|
|
1680
|
-
for (let [t, n] of T(
|
|
1674
|
+
function qr(e) {
|
|
1675
|
+
for (let [t, n] of T(Nr, this)) if (mr(e, n)) return !1;
|
|
1681
1676
|
return !0;
|
|
1682
1677
|
}
|
|
1683
|
-
function
|
|
1678
|
+
function Jr(e, n) {
|
|
1684
1679
|
var r = this;
|
|
1685
1680
|
return t(function* () {
|
|
1686
1681
|
try {
|
|
1687
|
-
T(
|
|
1682
|
+
T(I, r).debug("Setting server certificate", { certificate: n }), (yield e.setServerCertificate(n)) || T(I, r).warn("Server certificates are not supported by the CDM.");
|
|
1688
1683
|
} catch (e) {
|
|
1689
|
-
T(
|
|
1684
|
+
T(I, r).error("Failed to set server certificate", { error: e });
|
|
1690
1685
|
}
|
|
1691
1686
|
})();
|
|
1692
1687
|
}
|
|
1693
|
-
function
|
|
1688
|
+
function Yr(e) {
|
|
1694
1689
|
let { message: t, isFatal: n, error: r } = e;
|
|
1695
|
-
T(
|
|
1690
|
+
T(I, this).error(t, { error: r }), T(kr, this).emit("error", d(t, n, r));
|
|
1696
1691
|
}
|
|
1697
|
-
function
|
|
1692
|
+
function Xr(e) {
|
|
1698
1693
|
let t = [];
|
|
1699
1694
|
return e.clearkeys && t.push("clearkey"), e.playreadyLicenseUrl && t.push("playready"), e.widevineLicenseUrl && t.push("widevine"), e.fairplayLicenseUrl && e.fairplayCertificate && t.push("fairplay"), t;
|
|
1700
1695
|
}
|
|
1701
|
-
function
|
|
1696
|
+
function Zr(e) {
|
|
1702
1697
|
return {
|
|
1703
1698
|
fairplay: e.fairplayLicenseUrl,
|
|
1704
1699
|
playready: e.playreadyLicenseUrl,
|
|
@@ -1708,10 +1703,10 @@ function Xr(e) {
|
|
|
1708
1703
|
}
|
|
1709
1704
|
//#endregion
|
|
1710
1705
|
//#region ../../libs/media/src/h264/h264.ts
|
|
1711
|
-
var
|
|
1706
|
+
var Qr = 7, $r = 8, ei = (e) => {
|
|
1712
1707
|
let t = e.getUint32(0, !1), n = e.getUint8(0) << 16 | e.getUint16(1, !1), r = 0;
|
|
1713
1708
|
return n === 1 ? r += 3 : t === 1 && (r += 4), r;
|
|
1714
|
-
},
|
|
1709
|
+
}, ti = (e) => ei(new DataView(e, 0)) !== 0, ni = (e, t = 0) => {
|
|
1715
1710
|
for (let n = t; n < e.byteLength - 4; n++) {
|
|
1716
1711
|
let t = e.getUint32(n) === 1, r = (e.getUint8(n) << 16 | e.getUint16(n + 1)) == 1;
|
|
1717
1712
|
if (t || r) return {
|
|
@@ -1719,16 +1714,16 @@ var Zr = 7, Qr = 8, $r = (e) => {
|
|
|
1719
1714
|
nalPrefixSize: t ? 4 : 3
|
|
1720
1715
|
};
|
|
1721
1716
|
}
|
|
1722
|
-
},
|
|
1723
|
-
let n = new DataView(e, 0), r =
|
|
1717
|
+
}, ri = (e) => e & 31, ii = (e, t) => {
|
|
1718
|
+
let n = new DataView(e, 0), r = ni(n);
|
|
1724
1719
|
for (; r;) {
|
|
1725
|
-
let { position: i, nalPrefixSize: a } = r, o =
|
|
1720
|
+
let { position: i, nalPrefixSize: a } = r, o = ni(n, i + 4), s = o ? o.position - i - a : void 0;
|
|
1726
1721
|
if (!t(new DataView(e, i + a, s), a)) return;
|
|
1727
1722
|
r = o;
|
|
1728
1723
|
}
|
|
1729
|
-
},
|
|
1724
|
+
}, ai = (e) => {
|
|
1730
1725
|
let t = [], n = [];
|
|
1731
|
-
if (!
|
|
1726
|
+
if (!ti(e)) {
|
|
1732
1727
|
let r = new DataView(e, 0), i = r.getUint8(5) & 31, a = 6;
|
|
1733
1728
|
for (let n = 0; n < i; n++) {
|
|
1734
1729
|
let n = r.getUint16(a);
|
|
@@ -1745,13 +1740,13 @@ var Zr = 7, Qr = 8, $r = (e) => {
|
|
|
1745
1740
|
pictureParameterSets: n
|
|
1746
1741
|
};
|
|
1747
1742
|
}
|
|
1748
|
-
return
|
|
1743
|
+
return ii(e, (e) => {
|
|
1749
1744
|
let r = e.byteOffset + e.byteLength;
|
|
1750
|
-
switch (
|
|
1751
|
-
case
|
|
1745
|
+
switch (ri(e.getUint8(0))) {
|
|
1746
|
+
case $r:
|
|
1752
1747
|
n.push(e.buffer.slice(e.byteOffset, r));
|
|
1753
1748
|
break;
|
|
1754
|
-
case
|
|
1749
|
+
case Qr:
|
|
1755
1750
|
t.push(e.buffer.slice(e.byteOffset, r));
|
|
1756
1751
|
break;
|
|
1757
1752
|
}
|
|
@@ -1760,7 +1755,7 @@ var Zr = 7, Qr = 8, $r = (e) => {
|
|
|
1760
1755
|
sequenceParameterSets: t,
|
|
1761
1756
|
pictureParameterSets: n
|
|
1762
1757
|
};
|
|
1763
|
-
},
|
|
1758
|
+
}, oi = (e) => {
|
|
1764
1759
|
let t = new DataView(e), n = t.getUint8(1), r = t.getUint8(2), i = t.getUint8(3), a = new ke(e, 32);
|
|
1765
1760
|
a.readUnsignedExpGolomb();
|
|
1766
1761
|
let o = 1;
|
|
@@ -1803,7 +1798,7 @@ var Zr = 7, Qr = 8, $r = (e) => {
|
|
|
1803
1798
|
};
|
|
1804
1799
|
if (a.readBit() && a.readBit()) {
|
|
1805
1800
|
var m;
|
|
1806
|
-
p = (m =
|
|
1801
|
+
p = (m = si[a.readBits(8)]) == null ? {
|
|
1807
1802
|
numerator: 0,
|
|
1808
1803
|
denumerator: 0
|
|
1809
1804
|
} : m;
|
|
@@ -1816,7 +1811,7 @@ var Zr = 7, Qr = 8, $r = (e) => {
|
|
|
1816
1811
|
constraintFlags: r,
|
|
1817
1812
|
levelIdc: i
|
|
1818
1813
|
};
|
|
1819
|
-
},
|
|
1814
|
+
}, si = [
|
|
1820
1815
|
{
|
|
1821
1816
|
numerator: 0,
|
|
1822
1817
|
denumerator: 0
|
|
@@ -1885,7 +1880,7 @@ var Zr = 7, Qr = 8, $r = (e) => {
|
|
|
1885
1880
|
numerator: 2,
|
|
1886
1881
|
denumerator: 1
|
|
1887
1882
|
}
|
|
1888
|
-
],
|
|
1883
|
+
], ci = (e) => {
|
|
1889
1884
|
if (e.length <= 78) return;
|
|
1890
1885
|
let t = 78;
|
|
1891
1886
|
for (; t + 8 <= e.length;) {
|
|
@@ -1894,17 +1889,17 @@ var Zr = 7, Qr = 8, $r = (e) => {
|
|
|
1894
1889
|
if (i === "hvcC") return e.slice(t + 8, t + r);
|
|
1895
1890
|
t += r;
|
|
1896
1891
|
}
|
|
1897
|
-
},
|
|
1898
|
-
function
|
|
1899
|
-
let t = new Ne(e), n =
|
|
1900
|
-
(n.flags &
|
|
1901
|
-
let r =
|
|
1892
|
+
}, li = 184549376;
|
|
1893
|
+
function ui(e) {
|
|
1894
|
+
let t = new Ne(e), n = di(t);
|
|
1895
|
+
(n.flags & li) !== 0 && fi(t);
|
|
1896
|
+
let r = pi(t);
|
|
1902
1897
|
if (String.fromCharCode(...r.frameId) === "TXXX") return {
|
|
1903
1898
|
header: n,
|
|
1904
|
-
txx:
|
|
1899
|
+
txx: mi(new Ne(t.readBytes(r.size)))
|
|
1905
1900
|
};
|
|
1906
1901
|
}
|
|
1907
|
-
function
|
|
1902
|
+
function di(e) {
|
|
1908
1903
|
return {
|
|
1909
1904
|
id: e.readBytes(3),
|
|
1910
1905
|
majorVersion: e.readUint8(),
|
|
@@ -1913,18 +1908,18 @@ function ui(e) {
|
|
|
1913
1908
|
size: e.readUint32()
|
|
1914
1909
|
};
|
|
1915
1910
|
}
|
|
1916
|
-
function
|
|
1911
|
+
function fi(e) {
|
|
1917
1912
|
let t = e.readUint32();
|
|
1918
1913
|
return e.readBytes(t - 4), {};
|
|
1919
1914
|
}
|
|
1920
|
-
function
|
|
1915
|
+
function pi(e) {
|
|
1921
1916
|
return {
|
|
1922
1917
|
frameId: e.readBytes(4),
|
|
1923
1918
|
size: e.readUint32(),
|
|
1924
1919
|
flags: e.readUint16()
|
|
1925
1920
|
};
|
|
1926
1921
|
}
|
|
1927
|
-
function
|
|
1922
|
+
function mi(e) {
|
|
1928
1923
|
return {
|
|
1929
1924
|
encoding: e.readUint8(),
|
|
1930
1925
|
description: e.readUtf8String(),
|
|
@@ -1933,20 +1928,20 @@ function pi(e) {
|
|
|
1933
1928
|
}
|
|
1934
1929
|
//#endregion
|
|
1935
1930
|
//#region ../../libs/media/src/mp4/demuxing/atom.ts
|
|
1936
|
-
function
|
|
1931
|
+
function hi(e) {
|
|
1937
1932
|
let t = e.readUint32(), n = String.fromCharCode(e.readUint8(), e.readUint8(), e.readUint8(), e.readUint8());
|
|
1938
1933
|
return t === 1 && (t = e.readUint64() - 8), {
|
|
1939
1934
|
size: t - 8,
|
|
1940
1935
|
type: n
|
|
1941
1936
|
};
|
|
1942
1937
|
}
|
|
1943
|
-
function
|
|
1944
|
-
let n =
|
|
1938
|
+
function gi(e, t) {
|
|
1939
|
+
let n = hi(t), r = new Ne(t.readBytes(n.size));
|
|
1945
1940
|
if (n.type !== e.type) throw Error(`invalid error type: ${n.type}, expected ${e.type}`);
|
|
1946
1941
|
let i = e.decodeData(r);
|
|
1947
1942
|
return r.readRemaining(), i;
|
|
1948
1943
|
}
|
|
1949
|
-
function
|
|
1944
|
+
function _i(e) {
|
|
1950
1945
|
return {
|
|
1951
1946
|
version: e.readUint8(),
|
|
1952
1947
|
flags: e.readUint24()
|
|
@@ -1954,12 +1949,12 @@ function gi(e) {
|
|
|
1954
1949
|
}
|
|
1955
1950
|
//#endregion
|
|
1956
1951
|
//#region ../../libs/media/src/mp4/demuxing/emsg.ts
|
|
1957
|
-
var
|
|
1952
|
+
var vi = class t {
|
|
1958
1953
|
constructor({ timescale: n, presentationTime: r, presentationTimeDelta: i, schemeIdUri: a, value: o, eventDuration: s, id: c, data: l }) {
|
|
1959
1954
|
e(this, "type", t.type), e(this, "timescale", void 0), e(this, "presentationTime", void 0), e(this, "presentationTimeDelta", void 0), e(this, "schemeIdUri", void 0), e(this, "value", void 0), e(this, "eventDuration", void 0), e(this, "id", void 0), e(this, "data", void 0), this.timescale = n, this.presentationTime = r, this.presentationTimeDelta = i, this.schemeIdUri = a, this.value = o, this.eventDuration = s, this.id = c, this.data = l;
|
|
1960
1955
|
}
|
|
1961
1956
|
static decodeData(e) {
|
|
1962
|
-
let { version: n } =
|
|
1957
|
+
let { version: n } = _i(e);
|
|
1963
1958
|
switch (n) {
|
|
1964
1959
|
case 1: {
|
|
1965
1960
|
let n = e.readUint32(), r = e.readUint64(), i = e.readUint32(), a = e.readUint32(), o = e.readUtf8String(), s = e.readUtf8String(), c = e.remaining();
|
|
@@ -1989,10 +1984,10 @@ var _i = class t {
|
|
|
1989
1984
|
}
|
|
1990
1985
|
}
|
|
1991
1986
|
};
|
|
1992
|
-
e(
|
|
1987
|
+
e(vi, "type", "emsg");
|
|
1993
1988
|
//#endregion
|
|
1994
1989
|
//#region ../../libs/media/src/mp4/demuxing/mdat.ts
|
|
1995
|
-
var
|
|
1990
|
+
var yi = class t {
|
|
1996
1991
|
constructor(n) {
|
|
1997
1992
|
e(this, "type", t.type), e(this, "data", void 0), this.data = n;
|
|
1998
1993
|
}
|
|
@@ -2000,34 +1995,34 @@ var vi = class t {
|
|
|
2000
1995
|
return new t(e.readRemaining());
|
|
2001
1996
|
}
|
|
2002
1997
|
};
|
|
2003
|
-
e(
|
|
1998
|
+
e(yi, "type", "mdat");
|
|
2004
1999
|
//#endregion
|
|
2005
2000
|
//#region ../../libs/media/src/mp4/demuxing/moof/traf/tfdt.ts
|
|
2006
|
-
var
|
|
2001
|
+
var bi = class t {
|
|
2007
2002
|
constructor(n, r, i) {
|
|
2008
2003
|
e(this, "type", t.type), e(this, "extra", void 0), e(this, "byteOffset", void 0), e(this, "baseMediaDecodeTime", void 0), this.extra = n, this.byteOffset = r, this.baseMediaDecodeTime = i;
|
|
2009
2004
|
}
|
|
2010
2005
|
static decodeData(e) {
|
|
2011
|
-
let n =
|
|
2006
|
+
let n = _i(e), r = e.byteOffset(), i = 0;
|
|
2012
2007
|
return i = n.version === 1 ? e.readUint64() : e.readUint32(), new t(n, r, i);
|
|
2013
2008
|
}
|
|
2014
2009
|
};
|
|
2015
|
-
e(
|
|
2010
|
+
e(bi, "type", "tfdt");
|
|
2016
2011
|
//#endregion
|
|
2017
2012
|
//#region ../../libs/media/src/mp4/demuxing/moof/traf/tfhd.ts
|
|
2018
|
-
var
|
|
2013
|
+
var xi = 1, Si = 2, Ci = 8, wi = 16, Ti = 32, Ei = class t {
|
|
2019
2014
|
constructor(n, r, i, a) {
|
|
2020
2015
|
e(this, "type", t.type), e(this, "extra", void 0), e(this, "defaultSampleDuration", void 0), e(this, "defaultSampleSize", void 0), e(this, "defaultSampleFlags", void 0), this.extra = n, this.defaultSampleDuration = r, this.defaultSampleSize = i, this.defaultSampleFlags = a;
|
|
2021
2016
|
}
|
|
2022
2017
|
static decodeData(e) {
|
|
2023
|
-
let n =
|
|
2024
|
-
return e.readUint32(), (n.flags &
|
|
2018
|
+
let n = _i(e), r, i, a;
|
|
2019
|
+
return e.readUint32(), (n.flags & xi) > 0 && e.readUint64(), (n.flags & Si) > 0 && e.readUint32(), (n.flags & Ci) > 0 && (r = e.readUint32()), (n.flags & wi) > 0 && (i = e.readUint32()), (n.flags & Ti) > 0 && (a = e.readUint32()), new t(n, r, i, a);
|
|
2025
2020
|
}
|
|
2026
2021
|
};
|
|
2027
|
-
e(
|
|
2022
|
+
e(Ei, "type", "tfhd");
|
|
2028
2023
|
//#endregion
|
|
2029
2024
|
//#region ../../libs/media/src/mp4/demuxing/moof/traf/trun.ts
|
|
2030
|
-
var
|
|
2025
|
+
var Di = class t {
|
|
2031
2026
|
is_sync_sample(e) {
|
|
2032
2027
|
let n = t.FLAG_SAMPLE_FLAG_IS_NON_SYNC | t.FLAG_SAMPLE_DEPENDS_YES, r = this.sampleFlags[e];
|
|
2033
2028
|
if (r !== void 0) return (r & n) === 0;
|
|
@@ -2037,7 +2032,7 @@ var Ei = class t {
|
|
|
2037
2032
|
e(this, "type", t.type), e(this, "dataOffset", void 0), e(this, "firstSampleFlags", void 0), e(this, "samplesCount", void 0), e(this, "sampleDurations", []), e(this, "sampleSizes", []), e(this, "sampleFlags", []), e(this, "sampleCts", []), this.dataOffset = r, this.firstSampleFlags = i, this.samplesCount = n;
|
|
2038
2033
|
}
|
|
2039
2034
|
static decodeData(e) {
|
|
2040
|
-
let { version: n, flags: r } =
|
|
2035
|
+
let { version: n, flags: r } = _i(e), i = e.readUint32(), a, o;
|
|
2041
2036
|
r & t.TRUN_DATA_OFFSET && (a = e.readUint32()), r & t.TRUN_FIRST_SAMPLE_FLAGS && (o = e.readUint32());
|
|
2042
2037
|
let s = new t(i, a, o);
|
|
2043
2038
|
if ((r & (t.SAMPLE_DURATION | t.SAMPLE_SIZE | t.SAMPLE_FLAGS | t.SAMPLE_CTS)) === 0) return s;
|
|
@@ -2045,43 +2040,43 @@ var Ei = class t {
|
|
|
2045
2040
|
return s;
|
|
2046
2041
|
}
|
|
2047
2042
|
};
|
|
2048
|
-
e(
|
|
2043
|
+
e(Di, "TRUN_DATA_OFFSET", 1), e(Di, "TRUN_FIRST_SAMPLE_FLAGS", 4), e(Di, "SAMPLE_DURATION", 256), e(Di, "SAMPLE_SIZE", 512), e(Di, "SAMPLE_FLAGS", 1024), e(Di, "SAMPLE_CTS", 2048), e(Di, "FLAG_SAMPLE_FLAG_IS_NON_SYNC", 65536), e(Di, "FLAG_SAMPLE_DEPENDS_NO", 33554432), e(Di, "FLAG_SAMPLE_DEPENDS_YES", 16777216), e(Di, "type", "trun");
|
|
2049
2044
|
//#endregion
|
|
2050
2045
|
//#region ../../libs/media/src/mp4/demuxing/moof/traf.ts
|
|
2051
|
-
var
|
|
2046
|
+
var Oi = class t {
|
|
2052
2047
|
constructor(n, r, i) {
|
|
2053
2048
|
e(this, "type", t.type), e(this, "tfhd", void 0), e(this, "tfdt", void 0), e(this, "trun", void 0), this.tfhd = n, this.tfdt = r, this.trun = i;
|
|
2054
2049
|
}
|
|
2055
2050
|
static decodeData(e) {
|
|
2056
2051
|
let n, r, i;
|
|
2057
2052
|
for (; e.remaining() > 0;) {
|
|
2058
|
-
let t =
|
|
2059
|
-
t instanceof
|
|
2053
|
+
let t = Qi(e);
|
|
2054
|
+
t instanceof Ei && (n = t), t instanceof bi && (r = t), t instanceof Di && (i = t);
|
|
2060
2055
|
}
|
|
2061
2056
|
return new t(n, r, i);
|
|
2062
2057
|
}
|
|
2063
2058
|
};
|
|
2064
|
-
e(
|
|
2059
|
+
e(Oi, "type", "traf");
|
|
2065
2060
|
//#endregion
|
|
2066
2061
|
//#region ../../libs/media/src/mp4/demuxing/moof.ts
|
|
2067
|
-
var
|
|
2062
|
+
var ki = class t {
|
|
2068
2063
|
constructor(n) {
|
|
2069
2064
|
e(this, "type", t.type), e(this, "traf", void 0), this.traf = n;
|
|
2070
2065
|
}
|
|
2071
2066
|
static decodeData(e) {
|
|
2072
2067
|
let n;
|
|
2073
2068
|
for (; e.remaining() > 0;) {
|
|
2074
|
-
let t =
|
|
2075
|
-
t instanceof
|
|
2069
|
+
let t = Qi(e);
|
|
2070
|
+
t instanceof Oi && (n = t);
|
|
2076
2071
|
}
|
|
2077
2072
|
if (!n) throw Error("No traf found");
|
|
2078
2073
|
return new t(n);
|
|
2079
2074
|
}
|
|
2080
2075
|
};
|
|
2081
|
-
e(
|
|
2076
|
+
e(ki, "type", "moof");
|
|
2082
2077
|
//#endregion
|
|
2083
2078
|
//#region ../../libs/media/src/mp4/demuxing/moov/mvhd.ts
|
|
2084
|
-
var
|
|
2079
|
+
var Ai = class t {
|
|
2085
2080
|
constructor() {
|
|
2086
2081
|
e(this, "type", t.type);
|
|
2087
2082
|
}
|
|
@@ -2089,10 +2084,10 @@ var ki = class t {
|
|
|
2089
2084
|
return new t();
|
|
2090
2085
|
}
|
|
2091
2086
|
};
|
|
2092
|
-
e(
|
|
2087
|
+
e(Ai, "type", "mvhd");
|
|
2093
2088
|
//#endregion
|
|
2094
2089
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/mdia/hdlr.ts
|
|
2095
|
-
var
|
|
2090
|
+
var ji = class t {
|
|
2096
2091
|
constructor(n) {
|
|
2097
2092
|
e(this, "type", t.type), e(this, "fourCC", void 0), this.fourCC = n;
|
|
2098
2093
|
}
|
|
@@ -2105,25 +2100,25 @@ var Ai = class t {
|
|
|
2105
2100
|
}
|
|
2106
2101
|
}
|
|
2107
2102
|
static decodeData(e) {
|
|
2108
|
-
return
|
|
2103
|
+
return _i(e), e.readUint32(), new t(String.fromCharCode(...e.readBytes(4)));
|
|
2109
2104
|
}
|
|
2110
2105
|
};
|
|
2111
|
-
e(
|
|
2106
|
+
e(ji, "type", "hdlr");
|
|
2112
2107
|
//#endregion
|
|
2113
2108
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/mdia/mdhd.ts
|
|
2114
|
-
var
|
|
2109
|
+
var Mi = class t {
|
|
2115
2110
|
constructor(n, r, i, a) {
|
|
2116
2111
|
e(this, "type", t.type), e(this, "creationTime", void 0), e(this, "modificationTime", void 0), e(this, "timescale", void 0), e(this, "duration", void 0), this.creationTime = n, this.modificationTime = r, this.timescale = i, this.duration = a;
|
|
2117
2112
|
}
|
|
2118
2113
|
static decodeData(e) {
|
|
2119
|
-
let { version: n } =
|
|
2114
|
+
let { version: n } = _i(e);
|
|
2120
2115
|
return n === 1 ? new t(e.readUint64(), e.readUint64(), e.readUint32(), e.readUint64()) : new t(e.readUint32(), e.readUint32(), e.readUint32(), e.readUint32());
|
|
2121
2116
|
}
|
|
2122
2117
|
};
|
|
2123
|
-
e(
|
|
2118
|
+
e(Mi, "type", "mdhd");
|
|
2124
2119
|
//#endregion
|
|
2125
2120
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/mdia/minf/stbl/stsd.ts
|
|
2126
|
-
var
|
|
2121
|
+
var Ni = class t {
|
|
2127
2122
|
mediaType() {
|
|
2128
2123
|
return this.avc1 || this.hvc1 || this.hev1 || this.av01 ? "video" : "audio";
|
|
2129
2124
|
}
|
|
@@ -2139,10 +2134,10 @@ var Mi = class t {
|
|
|
2139
2134
|
e(this, "type", t.type), e(this, "av01", void 0), e(this, "avc1", void 0), e(this, "hvc1", void 0), e(this, "hev1", void 0), e(this, "mp4a", void 0), e(this, "opus", void 0), e(this, "codec", void 0), this.avc1 = n, this.hvc1 = r, this.hev1 = i, this.av01 = a, this.mp4a = o, this.opus = s, this.codec = c;
|
|
2140
2135
|
}
|
|
2141
2136
|
static decodeData(e) {
|
|
2142
|
-
|
|
2137
|
+
_i(e);
|
|
2143
2138
|
let n = e.readUint32(), r, i, a, o, s, c, l;
|
|
2144
2139
|
for (let t = 0; t < n; t++) for (; e.remaining() > 0;) {
|
|
2145
|
-
let t =
|
|
2140
|
+
let t = Qi(e);
|
|
2146
2141
|
switch (t.type) {
|
|
2147
2142
|
case "avc1":
|
|
2148
2143
|
r = "h264", i = t;
|
|
@@ -2167,52 +2162,52 @@ var Mi = class t {
|
|
|
2167
2162
|
return new t(i, a, o, l, s, c, r);
|
|
2168
2163
|
}
|
|
2169
2164
|
};
|
|
2170
|
-
e(
|
|
2165
|
+
e(Ni, "type", "stsd");
|
|
2171
2166
|
//#endregion
|
|
2172
2167
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/mdia/minf/stbl.ts
|
|
2173
|
-
var
|
|
2168
|
+
var Pi = class t {
|
|
2174
2169
|
constructor(n) {
|
|
2175
2170
|
e(this, "type", t.type), e(this, "stsd", void 0), this.stsd = n;
|
|
2176
2171
|
}
|
|
2177
2172
|
static decodeData(e) {
|
|
2178
2173
|
let n;
|
|
2179
2174
|
for (; e.remaining() > 0;) {
|
|
2180
|
-
let t =
|
|
2181
|
-
t instanceof
|
|
2175
|
+
let t = Qi(e);
|
|
2176
|
+
t instanceof Ni && (n = t);
|
|
2182
2177
|
}
|
|
2183
2178
|
if (!n) throw Error("No stsd found");
|
|
2184
2179
|
return new t(n);
|
|
2185
2180
|
}
|
|
2186
2181
|
};
|
|
2187
|
-
e(
|
|
2182
|
+
e(Pi, "type", "stbl");
|
|
2188
2183
|
//#endregion
|
|
2189
2184
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/mdia/minf.ts
|
|
2190
|
-
var
|
|
2185
|
+
var Fi = class t {
|
|
2191
2186
|
constructor(n) {
|
|
2192
2187
|
e(this, "type", t.type), e(this, "stbl", void 0), this.stbl = n;
|
|
2193
2188
|
}
|
|
2194
2189
|
static decodeData(e) {
|
|
2195
2190
|
let n;
|
|
2196
2191
|
for (; e.remaining() > 0;) {
|
|
2197
|
-
let t =
|
|
2198
|
-
t instanceof
|
|
2192
|
+
let t = Qi(e);
|
|
2193
|
+
t instanceof Pi && (n = t);
|
|
2199
2194
|
}
|
|
2200
2195
|
if (!n) throw Error("No stbl found");
|
|
2201
2196
|
return new t(n);
|
|
2202
2197
|
}
|
|
2203
2198
|
};
|
|
2204
|
-
e(
|
|
2199
|
+
e(Fi, "type", "minf");
|
|
2205
2200
|
//#endregion
|
|
2206
2201
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/mdia.ts
|
|
2207
|
-
var
|
|
2202
|
+
var Ii = class t {
|
|
2208
2203
|
constructor(n, r, i) {
|
|
2209
2204
|
e(this, "type", t.type), e(this, "hdlr", void 0), e(this, "minf", void 0), e(this, "mdhd", void 0), this.hdlr = n, this.minf = r, this.mdhd = i;
|
|
2210
2205
|
}
|
|
2211
2206
|
static decodeData(e) {
|
|
2212
2207
|
let n, r, i;
|
|
2213
2208
|
for (; e.remaining() > 0;) {
|
|
2214
|
-
let t =
|
|
2215
|
-
t instanceof
|
|
2209
|
+
let t = Qi(e);
|
|
2210
|
+
t instanceof ji && (n = t), t instanceof Fi && (r = t), t instanceof Mi && (i = t);
|
|
2216
2211
|
}
|
|
2217
2212
|
if (!n) throw Error("No hdlr found");
|
|
2218
2213
|
if (!r) throw Error("No minf found");
|
|
@@ -2220,15 +2215,15 @@ var Fi = class t {
|
|
|
2220
2215
|
return new t(n, r, i);
|
|
2221
2216
|
}
|
|
2222
2217
|
};
|
|
2223
|
-
e(
|
|
2218
|
+
e(Ii, "type", "mdia");
|
|
2224
2219
|
//#endregion
|
|
2225
2220
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/tkhd.ts
|
|
2226
|
-
var
|
|
2221
|
+
var Li = class t {
|
|
2227
2222
|
constructor(n, r, i, a, o, s, c, l) {
|
|
2228
2223
|
e(this, "type", t.type), e(this, "modificationTime", void 0), e(this, "creationTime", void 0), e(this, "trackId", void 0), e(this, "duration", void 0), e(this, "alternateGroup", void 0), e(this, "volume", void 0), e(this, "width", void 0), e(this, "height", void 0), this.modificationTime = n, this.creationTime = r, this.trackId = i, this.duration = a, this.alternateGroup = o, this.volume = s, this.width = c, this.height = l;
|
|
2229
2224
|
}
|
|
2230
2225
|
static decodeData(e) {
|
|
2231
|
-
let n =
|
|
2226
|
+
let n = _i(e), r = 0, i = 0;
|
|
2232
2227
|
n.version === 1 ? (r = e.readUint64(), i = e.readUint64()) : (r = e.readUint32(), i = e.readUint32());
|
|
2233
2228
|
let a = e.readUint32();
|
|
2234
2229
|
e.readUint32();
|
|
@@ -2242,45 +2237,45 @@ var Ii = class t {
|
|
|
2242
2237
|
return e.readUint16(), new t(r, i, a, o, s, c, l, u);
|
|
2243
2238
|
}
|
|
2244
2239
|
};
|
|
2245
|
-
e(
|
|
2240
|
+
e(Li, "type", "tkhd");
|
|
2246
2241
|
//#endregion
|
|
2247
2242
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak.ts
|
|
2248
|
-
var
|
|
2243
|
+
var Ri = class t {
|
|
2249
2244
|
constructor(n, r) {
|
|
2250
2245
|
e(this, "type", t.type), e(this, "tkhd", void 0), e(this, "mdia", void 0), this.tkhd = n, this.mdia = r;
|
|
2251
2246
|
}
|
|
2252
2247
|
static decodeData(e) {
|
|
2253
2248
|
let n, r;
|
|
2254
2249
|
for (; e.remaining() > 0;) {
|
|
2255
|
-
let t =
|
|
2256
|
-
t instanceof
|
|
2250
|
+
let t = Qi(e);
|
|
2251
|
+
t instanceof Li && (n = t), t instanceof Ii && (r = t);
|
|
2257
2252
|
}
|
|
2258
2253
|
if (!n) throw Error("No tkhd found");
|
|
2259
2254
|
if (!r) throw Error("No mdia found");
|
|
2260
2255
|
return new t(n, r);
|
|
2261
2256
|
}
|
|
2262
2257
|
};
|
|
2263
|
-
e(
|
|
2258
|
+
e(Ri, "type", "trak");
|
|
2264
2259
|
//#endregion
|
|
2265
2260
|
//#region ../../libs/media/src/mp4/demuxing/moov.ts
|
|
2266
|
-
var
|
|
2261
|
+
var zi = class t {
|
|
2267
2262
|
constructor(n, r) {
|
|
2268
2263
|
e(this, "type", t.type), e(this, "mvhd", void 0), e(this, "traks", void 0), this.mvhd = n, this.traks = r;
|
|
2269
2264
|
}
|
|
2270
2265
|
static decodeData(e) {
|
|
2271
2266
|
let n, r = [];
|
|
2272
2267
|
for (; e.remaining() > 0;) {
|
|
2273
|
-
let t =
|
|
2274
|
-
t instanceof
|
|
2268
|
+
let t = Qi(e);
|
|
2269
|
+
t instanceof Ri && r.push(t), t instanceof Ai && (n = t);
|
|
2275
2270
|
}
|
|
2276
2271
|
if (!n) throw Error("No mvhd found");
|
|
2277
2272
|
return new t(n, r);
|
|
2278
2273
|
}
|
|
2279
2274
|
};
|
|
2280
|
-
e(
|
|
2275
|
+
e(zi, "type", "moov");
|
|
2281
2276
|
//#endregion
|
|
2282
2277
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/mdia/minf/stbl/avc1.ts
|
|
2283
|
-
var
|
|
2278
|
+
var Bi = class t {
|
|
2284
2279
|
constructor(n, r, i, a, o, s, c, l) {
|
|
2285
2280
|
e(this, "type", t.type), e(this, "configurationVersion", void 0), e(this, "avcProfileIndication", void 0), e(this, "profileCompatibility", void 0), e(this, "avcLevelIndication", void 0), e(this, "lengthSizeMinusOne", void 0), e(this, "sequenceParameterSets", void 0), e(this, "pictureParameterSets", void 0), e(this, "bytes", void 0), this.configurationVersion = n, this.avcProfileIndication = r, this.profileCompatibility = i, this.avcLevelIndication = a, this.lengthSizeMinusOne = o, this.sequenceParameterSets = s, this.pictureParameterSets = c, this.bytes = l;
|
|
2286
2281
|
}
|
|
@@ -2298,8 +2293,8 @@ var zi = class t {
|
|
|
2298
2293
|
return new t(r, i, a, o, s, l, d, n);
|
|
2299
2294
|
}
|
|
2300
2295
|
};
|
|
2301
|
-
e(
|
|
2302
|
-
var
|
|
2296
|
+
e(Bi, "type", "avcC");
|
|
2297
|
+
var Vi = class t {
|
|
2303
2298
|
constructor(n, r, i, a, o) {
|
|
2304
2299
|
e(this, "type", t.type), e(this, "avcC", void 0), e(this, "width", void 0), e(this, "height", void 0), e(this, "horizontalResolution", void 0), e(this, "verticalResolution", void 0), this.avcC = n, this.width = r, this.height = i, this.horizontalResolution = a, this.verticalResolution = o;
|
|
2305
2300
|
}
|
|
@@ -2309,7 +2304,7 @@ var Bi = class t {
|
|
|
2309
2304
|
e.readUint32(), e.readUint16(), e.readBytes(32), e.readUint16(), e.readUint16();
|
|
2310
2305
|
let o;
|
|
2311
2306
|
for (; e.remaining() > 0;) {
|
|
2312
|
-
let t =
|
|
2307
|
+
let t = Qi(e);
|
|
2313
2308
|
switch (t.type) {
|
|
2314
2309
|
case "avcC":
|
|
2315
2310
|
o = t;
|
|
@@ -2320,10 +2315,10 @@ var Bi = class t {
|
|
|
2320
2315
|
return new t(o, n, r, i, a);
|
|
2321
2316
|
}
|
|
2322
2317
|
};
|
|
2323
|
-
e(
|
|
2318
|
+
e(Vi, "type", "avc1");
|
|
2324
2319
|
//#endregion
|
|
2325
2320
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/mdia/minf/stbl/Mp4a.ts
|
|
2326
|
-
var
|
|
2321
|
+
var Hi = (e) => {
|
|
2327
2322
|
for (let t = 0; t < e.length - 1; t++) {
|
|
2328
2323
|
if (e[t] !== 5) continue;
|
|
2329
2324
|
let n = 0, r = 0, i = t + 1;
|
|
@@ -2335,17 +2330,17 @@ var Vi = (e) => {
|
|
|
2335
2330
|
let a = t + 1 + r, o = a + n;
|
|
2336
2331
|
if (o <= e.length) return e.slice(a, o);
|
|
2337
2332
|
}
|
|
2338
|
-
},
|
|
2333
|
+
}, Ui = class t {
|
|
2339
2334
|
constructor(n) {
|
|
2340
2335
|
e(this, "type", t.type), e(this, "decoderConfig", void 0), this.decoderConfig = n;
|
|
2341
2336
|
}
|
|
2342
2337
|
static decodeData(e) {
|
|
2343
2338
|
var n;
|
|
2344
|
-
return
|
|
2339
|
+
return _i(e), new t((n = Hi(e.readRemaining())) == null ? new Uint8Array() : n);
|
|
2345
2340
|
}
|
|
2346
2341
|
};
|
|
2347
|
-
e(
|
|
2348
|
-
var
|
|
2342
|
+
e(Ui, "type", "esds");
|
|
2343
|
+
var Wi = class t {
|
|
2349
2344
|
constructor(n, r, i) {
|
|
2350
2345
|
e(this, "type", t.type), e(this, "channelCount", void 0), e(this, "sampleRate", void 0), e(this, "esds", void 0), this.channelCount = n, this.sampleRate = r, this.esds = i;
|
|
2351
2346
|
}
|
|
@@ -2359,16 +2354,16 @@ var Ui = class t {
|
|
|
2359
2354
|
e.readUint16(), n === 1 ? e.readBytes(16) : n === 2 && e.readBytes(36);
|
|
2360
2355
|
let a;
|
|
2361
2356
|
for (; e.remaining() > 0;) {
|
|
2362
|
-
let t =
|
|
2357
|
+
let t = Qi(e);
|
|
2363
2358
|
t.type === "esds" && (a = t);
|
|
2364
2359
|
}
|
|
2365
2360
|
return new t(r, i, a);
|
|
2366
2361
|
}
|
|
2367
2362
|
};
|
|
2368
|
-
e(
|
|
2363
|
+
e(Wi, "type", "mp4a");
|
|
2369
2364
|
//#endregion
|
|
2370
2365
|
//#region ../../libs/media/src/mp4/demuxing/moov/trak/mdia/minf/stbl/Opus.ts
|
|
2371
|
-
var
|
|
2366
|
+
var Gi = class t {
|
|
2372
2367
|
constructor(n, r, i, a, o, s, c) {
|
|
2373
2368
|
e(this, "type", t.type), e(this, "version", void 0), e(this, "channelCount", void 0), e(this, "preSkip", void 0), e(this, "inputSampleRate", void 0), e(this, "outputGain", void 0), e(this, "channelMappingFamily", void 0), e(this, "channelMappingTable", void 0), this.version = n, this.channelCount = r, this.preSkip = i, this.inputSampleRate = a, this.outputGain = o, this.channelMappingFamily = s, this.channelMappingTable = c;
|
|
2374
2369
|
}
|
|
@@ -2377,8 +2372,8 @@ var Wi = class t {
|
|
|
2377
2372
|
return new t(n, r, i, a, o > 32767 ? o - 65536 : o, e.readUint8(), e.readRemaining());
|
|
2378
2373
|
}
|
|
2379
2374
|
};
|
|
2380
|
-
e(
|
|
2381
|
-
var
|
|
2375
|
+
e(Gi, "type", "dOps");
|
|
2376
|
+
var Ki = class t {
|
|
2382
2377
|
constructor(n, r, i) {
|
|
2383
2378
|
e(this, "type", t.type), e(this, "dops", void 0), e(this, "channelCount", void 0), e(this, "sampleRate", void 0), this.dops = n, this.channelCount = r, this.sampleRate = i;
|
|
2384
2379
|
}
|
|
@@ -2389,13 +2384,13 @@ var Gi = class t {
|
|
|
2389
2384
|
let r = e.readUint16();
|
|
2390
2385
|
e.readUint16(), e.readUint32();
|
|
2391
2386
|
let i = e.readUint16();
|
|
2392
|
-
return e.readUint16(), n === 1 && (e.readUint64(), e.readUint64()), new t(
|
|
2387
|
+
return e.readUint16(), n === 1 && (e.readUint64(), e.readUint64()), new t(gi(Gi, e), r, i);
|
|
2393
2388
|
}
|
|
2394
2389
|
};
|
|
2395
|
-
e(
|
|
2390
|
+
e(Ki, "type", "Opus");
|
|
2396
2391
|
//#endregion
|
|
2397
2392
|
//#region ../../libs/media/src/mp4/demuxing/prft.ts
|
|
2398
|
-
var
|
|
2393
|
+
var qi = class t {
|
|
2399
2394
|
constructor(n, r) {
|
|
2400
2395
|
e(this, "type", t.type), e(this, "ntpTimestamp", void 0), e(this, "mediaTime", void 0), this.ntpTimestamp = n, this.mediaTime = r;
|
|
2401
2396
|
}
|
|
@@ -2404,7 +2399,7 @@ var Ki = class t {
|
|
|
2404
2399
|
return new Date(r.getTime() + n);
|
|
2405
2400
|
}
|
|
2406
2401
|
static decodeData(e) {
|
|
2407
|
-
let { version: n } =
|
|
2402
|
+
let { version: n } = _i(e);
|
|
2408
2403
|
e.readUint32();
|
|
2409
2404
|
let r = e.readUint32(), i = e.readUint32();
|
|
2410
2405
|
if (n === 1) {
|
|
@@ -2415,48 +2410,48 @@ var Ki = class t {
|
|
|
2415
2410
|
return new t([r, i], a);
|
|
2416
2411
|
}
|
|
2417
2412
|
};
|
|
2418
|
-
e(
|
|
2413
|
+
e(qi, "type", "prft");
|
|
2419
2414
|
//#endregion
|
|
2420
2415
|
//#region ../../libs/media/src/mp4/demuxing/unrecognized.ts
|
|
2421
|
-
var
|
|
2416
|
+
var Ji = /* @__PURE__ */ new WeakMap(), Yi = /* @__PURE__ */ new WeakMap(), Xi = class {
|
|
2422
2417
|
constructor(e, t) {
|
|
2423
|
-
C(this,
|
|
2418
|
+
C(this, Ji, void 0), C(this, Yi, void 0), E(Ji, this, e), E(Yi, this, t.readBytes(e.size));
|
|
2424
2419
|
}
|
|
2425
2420
|
data() {
|
|
2426
|
-
return T(
|
|
2421
|
+
return T(Yi, this);
|
|
2427
2422
|
}
|
|
2428
2423
|
get type() {
|
|
2429
|
-
return T(
|
|
2430
|
-
}
|
|
2431
|
-
},
|
|
2432
|
-
moov:
|
|
2433
|
-
trak:
|
|
2434
|
-
tkhd:
|
|
2435
|
-
mvhd:
|
|
2436
|
-
moof:
|
|
2437
|
-
traf:
|
|
2438
|
-
tfhd:
|
|
2439
|
-
tfdt:
|
|
2440
|
-
trun:
|
|
2441
|
-
mdat:
|
|
2442
|
-
mdia:
|
|
2443
|
-
hdlr:
|
|
2444
|
-
minf:
|
|
2445
|
-
stbl:
|
|
2446
|
-
mdhd:
|
|
2447
|
-
stsd:
|
|
2448
|
-
prft:
|
|
2449
|
-
avc1:
|
|
2450
|
-
avcC:
|
|
2451
|
-
esds:
|
|
2452
|
-
mp4a:
|
|
2453
|
-
Opus:
|
|
2454
|
-
emsg:
|
|
2424
|
+
return T(Ji, this).type;
|
|
2425
|
+
}
|
|
2426
|
+
}, Zi = {
|
|
2427
|
+
moov: zi,
|
|
2428
|
+
trak: Ri,
|
|
2429
|
+
tkhd: Li,
|
|
2430
|
+
mvhd: Ai,
|
|
2431
|
+
moof: ki,
|
|
2432
|
+
traf: Oi,
|
|
2433
|
+
tfhd: Ei,
|
|
2434
|
+
tfdt: bi,
|
|
2435
|
+
trun: Di,
|
|
2436
|
+
mdat: yi,
|
|
2437
|
+
mdia: Ii,
|
|
2438
|
+
hdlr: ji,
|
|
2439
|
+
minf: Fi,
|
|
2440
|
+
stbl: Pi,
|
|
2441
|
+
mdhd: Mi,
|
|
2442
|
+
stsd: Ni,
|
|
2443
|
+
prft: qi,
|
|
2444
|
+
avc1: Vi,
|
|
2445
|
+
avcC: Bi,
|
|
2446
|
+
esds: Ui,
|
|
2447
|
+
mp4a: Wi,
|
|
2448
|
+
Opus: Ki,
|
|
2449
|
+
emsg: vi
|
|
2455
2450
|
};
|
|
2456
|
-
function
|
|
2457
|
-
let t =
|
|
2451
|
+
function Qi(e) {
|
|
2452
|
+
let t = hi(e), n = Zi[t.type], r = new Ne(e.readBytes(t.size));
|
|
2458
2453
|
if (!n) {
|
|
2459
|
-
let e = new
|
|
2454
|
+
let e = new Xi(t, r);
|
|
2460
2455
|
return r.readRemaining(), e;
|
|
2461
2456
|
}
|
|
2462
2457
|
let i = n.decodeData(r);
|
|
@@ -2464,32 +2459,32 @@ function Zi(e) {
|
|
|
2464
2459
|
}
|
|
2465
2460
|
//#endregion
|
|
2466
2461
|
//#region ../../libs/media/src/mp4/demuxing/boxes.ts
|
|
2467
|
-
function
|
|
2462
|
+
function $i(e) {
|
|
2468
2463
|
if (e.byteLength < 8) throw Error("Buffer too small");
|
|
2469
2464
|
let t = new Ne(e), n = /* @__PURE__ */ new Map();
|
|
2470
2465
|
for (; t.remaining() > 0;) {
|
|
2471
|
-
let e =
|
|
2466
|
+
let e = Qi(t);
|
|
2472
2467
|
n.set(e.type, e);
|
|
2473
2468
|
}
|
|
2474
2469
|
let r = n.get("ftyp"), i = n.get("moov");
|
|
2475
2470
|
if (!r) throw Error("ftyp atom not found");
|
|
2476
|
-
if (!i || !(i instanceof
|
|
2471
|
+
if (!i || !(i instanceof zi)) throw Error("moov atom not found");
|
|
2477
2472
|
return {
|
|
2478
2473
|
ftyp: r,
|
|
2479
2474
|
moov: i
|
|
2480
2475
|
};
|
|
2481
2476
|
}
|
|
2482
|
-
function
|
|
2477
|
+
function ea(e) {
|
|
2483
2478
|
if (e.byteLength < 8) throw Error("Buffer too small");
|
|
2484
2479
|
let t = new Ne(e), n = /* @__PURE__ */ new Map(), r = [];
|
|
2485
2480
|
for (; t.remaining() > 0;) {
|
|
2486
|
-
let e =
|
|
2487
|
-
e instanceof
|
|
2481
|
+
let e = Qi(t);
|
|
2482
|
+
e instanceof vi && r.push(e), n.set(e.type, e);
|
|
2488
2483
|
}
|
|
2489
2484
|
let i = n.get("moof"), a = n.get("mdat"), o = n.get("prft");
|
|
2490
|
-
if (!i || !(i instanceof
|
|
2491
|
-
if (!a || !(a instanceof
|
|
2492
|
-
if (o && !(o instanceof
|
|
2485
|
+
if (!i || !(i instanceof ki)) throw Error("moof atom not found");
|
|
2486
|
+
if (!a || !(a instanceof yi)) throw Error("mdat atom not found");
|
|
2487
|
+
if (o && !(o instanceof qi)) throw Error("invalid prft found");
|
|
2493
2488
|
return {
|
|
2494
2489
|
moof: i,
|
|
2495
2490
|
mdat: a,
|
|
@@ -2499,99 +2494,99 @@ function $i(e) {
|
|
|
2499
2494
|
}
|
|
2500
2495
|
//#endregion
|
|
2501
2496
|
//#region ../../libs/media/src/mp4/demuxing/demuxer.ts
|
|
2502
|
-
var
|
|
2497
|
+
var ta = (e, t) => e && e.length > 0 ? { perSample: e } : { defaultValue: t }, na = 1e4, ra = (e) => {
|
|
2503
2498
|
if (!e || e.length <= 1) return;
|
|
2504
2499
|
let t = Array(e.length), n = 0;
|
|
2505
2500
|
for (let r = 0; r < e.length; r++) t[r] = n, n += e[r] || 0;
|
|
2506
2501
|
return t;
|
|
2507
|
-
},
|
|
2502
|
+
}, ia = /* @__PURE__ */ new WeakMap(), aa = /* @__PURE__ */ new WeakMap(), oa = class {
|
|
2508
2503
|
constructor(e) {
|
|
2509
|
-
C(this,
|
|
2504
|
+
C(this, ia, void 0), C(this, aa, void 0), E(ia, this, e), E(aa, this, $i(e));
|
|
2510
2505
|
}
|
|
2511
2506
|
rawBytes() {
|
|
2512
|
-
return T(
|
|
2507
|
+
return T(ia, this);
|
|
2513
2508
|
}
|
|
2514
2509
|
init() {
|
|
2515
|
-
return T(
|
|
2510
|
+
return T(aa, this);
|
|
2516
2511
|
}
|
|
2517
|
-
},
|
|
2512
|
+
}, sa = /* @__PURE__ */ new WeakMap(), ca = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), la = /* @__PURE__ */ new WeakMap(), ua = /* @__PURE__ */ new WeakMap(), da = /* @__PURE__ */ new WeakMap(), fa = /* @__PURE__ */ new WeakMap(), pa = /* @__PURE__ */ new WeakMap(), ma = /* @__PURE__ */ new WeakMap(), ha = /* @__PURE__ */ new WeakMap(), ga = /* @__PURE__ */ new WeakMap(), _a = class e {
|
|
2518
2513
|
clone() {
|
|
2519
|
-
return new e(T(
|
|
2514
|
+
return new e(T(ca, this), new Uint8Array(T(sa, this).buffer.slice(T(sa, this).byteOffset, T(sa, this).byteOffset + T(sa, this).byteLength)));
|
|
2520
2515
|
}
|
|
2521
2516
|
constructor(e, t) {
|
|
2522
2517
|
var n, r;
|
|
2523
|
-
C(this,
|
|
2524
|
-
let i = T(
|
|
2525
|
-
i !== void 0 && (i.sampleSizes.length > 0 || i.sampleDurations.length > 0 || i.sampleFlags.length > 0 || i.sampleCts.length > 0) ? E(
|
|
2526
|
-
let c = o === 0 && T(
|
|
2527
|
-
E(
|
|
2518
|
+
C(this, sa, void 0), C(this, ca, void 0), C(this, R, void 0), C(this, la, void 0), C(this, ua, void 0), C(this, da, void 0), C(this, fa, void 0), C(this, pa, void 0), C(this, ma, void 0), C(this, ha, void 0), C(this, ga, void 0), E(sa, this, t), E(ca, this, e), E(R, this, ea(t)), E(la, this, T(ca, this).init().moov.traks[0]);
|
|
2519
|
+
let i = T(R, this).moof.traf.trun, a = T(R, this).moof.traf.tfhd, o = a == null ? void 0 : a.defaultSampleSize, s = (n = i == null ? void 0 : i.samplesCount) == null ? 0 : n;
|
|
2520
|
+
i !== void 0 && (i.sampleSizes.length > 0 || i.sampleDurations.length > 0 || i.sampleFlags.length > 0 || i.sampleCts.length > 0) ? E(ua, this, s) : o !== void 0 && o > 0 ? E(ua, this, Math.min(s, Math.floor(T(R, this).mdat.data.byteLength / o))) : E(ua, this, Math.min(s, na)), E(da, this, s - T(ua, this)), E(fa, this, ta(i == null ? void 0 : i.sampleDurations, a == null ? void 0 : a.defaultSampleDuration));
|
|
2521
|
+
let c = o === 0 && T(R, this).mdat.data.byteLength > 0;
|
|
2522
|
+
E(pa, this, ta(i == null ? void 0 : i.sampleSizes, c ? void 0 : o)), E(ma, this, ra(T(pa, this).perSample)), E(ha, this, ra(T(fa, this).perSample)), E(ga, this, T(fa, this).perSample ? T(fa, this).perSample.reduce((e, t) => e + t, 0) : ((r = T(fa, this).defaultValue) == null ? 0 : r) * T(ua, this));
|
|
2528
2523
|
}
|
|
2529
2524
|
updateBaseMediaDecodeTime(e) {
|
|
2530
|
-
let t = new DataView(T(
|
|
2531
|
-
if (T(
|
|
2525
|
+
let t = new DataView(T(sa, this).buffer, T(sa, this).byteOffset, T(sa, this).byteLength);
|
|
2526
|
+
if (T(R, this).moof.traf.tfdt) if (T(R, this).moof.traf.tfdt.baseMediaDecodeTime = e, T(R, this).moof.traf.tfdt.extra.version === 1) {
|
|
2532
2527
|
let n = Math.floor(e / 4294967296), r = (e & 4294967295) >>> 0;
|
|
2533
|
-
t.setUint32(T(
|
|
2534
|
-
} else t.setUint32(T(
|
|
2528
|
+
t.setUint32(T(R, this).moof.traf.tfdt.byteOffset - T(sa, this).byteOffset, n), t.setUint32(T(R, this).moof.traf.tfdt.byteOffset - T(sa, this).byteOffset + 4, r);
|
|
2529
|
+
} else t.setUint32(T(R, this).moof.traf.tfdt.byteOffset - T(sa, this).byteOffset, e);
|
|
2535
2530
|
}
|
|
2536
2531
|
producerReferenceTime() {
|
|
2537
|
-
if (T(
|
|
2532
|
+
if (T(R, this).prft) return T(R, this).prft.date();
|
|
2538
2533
|
}
|
|
2539
2534
|
duration() {
|
|
2540
|
-
return T(
|
|
2535
|
+
return T(ga, this);
|
|
2541
2536
|
}
|
|
2542
2537
|
baseMediaDecodeTime() {
|
|
2543
2538
|
var e;
|
|
2544
|
-
let t = (e = T(
|
|
2539
|
+
let t = (e = T(R, this).moof.traf.tfdt) == null ? void 0 : e.baseMediaDecodeTime;
|
|
2545
2540
|
if (!t) throw Error("no baseMediaDecodeTime");
|
|
2546
2541
|
return t;
|
|
2547
2542
|
}
|
|
2548
2543
|
startsWithKeyframe() {
|
|
2549
2544
|
var e;
|
|
2550
|
-
let t = T(
|
|
2551
|
-
return n ? (n &
|
|
2545
|
+
let t = T(R, this).moof.traf.trun, n = (t == null ? void 0 : t.firstSampleFlags) || (t == null ? void 0 : t.sampleFlags[0]) || ((e = T(R, this).moof.traf.tfhd) == null ? void 0 : e.defaultSampleFlags);
|
|
2546
|
+
return n ? (n & Di.FLAG_SAMPLE_DEPENDS_NO) !== 0 : !1;
|
|
2552
2547
|
}
|
|
2553
2548
|
compositionTimeOffset(e) {
|
|
2554
2549
|
var t;
|
|
2555
|
-
return (t = T(
|
|
2550
|
+
return (t = T(R, this).moof.traf.trun) == null ? void 0 : t.sampleCts[e];
|
|
2556
2551
|
}
|
|
2557
2552
|
sampleCompositionTimeOffsets() {
|
|
2558
2553
|
var e, t;
|
|
2559
|
-
return (e = (t = T(
|
|
2554
|
+
return (e = (t = T(R, this).moof.traf.trun) == null ? void 0 : t.sampleCts) == null ? [] : e;
|
|
2560
2555
|
}
|
|
2561
2556
|
timescale() {
|
|
2562
|
-
let e = T(
|
|
2557
|
+
let e = T(la, this);
|
|
2563
2558
|
if (!e) throw Error("no tracks");
|
|
2564
2559
|
return e.mdia.mdhd.timescale;
|
|
2565
2560
|
}
|
|
2566
2561
|
mediaType() {
|
|
2567
2562
|
var e;
|
|
2568
|
-
let t = (e = T(
|
|
2563
|
+
let t = (e = T(la, this)) == null ? void 0 : e.mdia.hdlr.mediaType();
|
|
2569
2564
|
if (!t) throw Error("no media type");
|
|
2570
2565
|
return t;
|
|
2571
2566
|
}
|
|
2572
2567
|
header() {
|
|
2573
|
-
return T(
|
|
2568
|
+
return T(ca, this);
|
|
2574
2569
|
}
|
|
2575
2570
|
fragment() {
|
|
2576
|
-
return T(
|
|
2571
|
+
return T(R, this);
|
|
2577
2572
|
}
|
|
2578
2573
|
samplesCount() {
|
|
2579
|
-
return T(
|
|
2574
|
+
return T(ua, this);
|
|
2580
2575
|
}
|
|
2581
2576
|
unbackedSamplesCount() {
|
|
2582
|
-
return T(
|
|
2577
|
+
return T(da, this);
|
|
2583
2578
|
}
|
|
2584
2579
|
sample(e) {
|
|
2585
2580
|
var t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, ee;
|
|
2586
|
-
let _ = T(
|
|
2581
|
+
let _ = T(R, this).moof.traf.trun, v = T(la, this), y = T(ua, this), te = (t = T(R, this).moof.traf.tfdt) == null ? void 0 : t.baseMediaDecodeTime;
|
|
2587
2582
|
if (e >= y || te === void 0 || !v) return;
|
|
2588
2583
|
let b = v.mdia.minf.stbl.stsd, ne = b.codec;
|
|
2589
2584
|
if (!ne) return;
|
|
2590
|
-
let x = _ == null ? void 0 : _.sampleCts[e], S = (n = (r = (i = T(
|
|
2585
|
+
let x = _ == null ? void 0 : _.sampleCts[e], S = (n = (r = (i = T(fa, this).perSample) == null ? void 0 : i[e]) == null ? T(fa, this).defaultValue : r) == null ? 0 : n, C = te + ((a = (o = T(ha, this)) == null ? void 0 : o[e]) == null ? e * ((s = T(fa, this).defaultValue) == null ? 0 : s) : a), w = v.mdia.mdhd.timescale || 1e3, E = (c = (l = (u = T(pa, this).perSample) == null ? void 0 : u[e]) == null ? T(pa, this).defaultValue : l) == null ? y === 1 ? T(R, this).mdat.data.byteLength : void 0 : c;
|
|
2591
2586
|
if (E === void 0) return;
|
|
2592
|
-
let D = (d = (f = T(
|
|
2593
|
-
if (D + E > T(
|
|
2594
|
-
let re = T(
|
|
2587
|
+
let D = (d = (f = T(ma, this)) == null ? void 0 : f[e]) == null ? e * ((p = T(pa, this).defaultValue) == null ? 0 : p) : d;
|
|
2588
|
+
if (D + E > T(R, this).mdat.data.byteLength) return;
|
|
2589
|
+
let re = T(R, this).mdat.data.subarray(D, D + E), ie = (_ == null ? void 0 : _.is_sync_sample(e)) || !1;
|
|
2595
2590
|
return v.mdia.hdlr.mediaType() === "video" ? {
|
|
2596
2591
|
type: "video",
|
|
2597
2592
|
codec: ne,
|
|
@@ -2617,93 +2612,93 @@ var ea = (e, t) => e && e.length > 0 ? { perSample: e } : { defaultValue: t }, t
|
|
|
2617
2612
|
};
|
|
2618
2613
|
}
|
|
2619
2614
|
rawBytes() {
|
|
2620
|
-
return T(
|
|
2615
|
+
return T(sa, this);
|
|
2621
2616
|
}
|
|
2622
|
-
},
|
|
2617
|
+
}, va = /* @__PURE__ */ new WeakMap(), ya = class {
|
|
2623
2618
|
constructor(e) {
|
|
2624
|
-
C(this,
|
|
2619
|
+
C(this, va, void 0), E(va, this, new oa(e));
|
|
2625
2620
|
}
|
|
2626
2621
|
header() {
|
|
2627
|
-
return T(
|
|
2622
|
+
return T(va, this);
|
|
2628
2623
|
}
|
|
2629
2624
|
createFragment(e) {
|
|
2630
|
-
return new
|
|
2625
|
+
return new _a(T(va, this), e);
|
|
2631
2626
|
}
|
|
2632
2627
|
};
|
|
2633
2628
|
//#endregion
|
|
2634
2629
|
//#region ../../libs/media/src/mp4/str2ab.ts
|
|
2635
|
-
function
|
|
2630
|
+
function z(e) {
|
|
2636
2631
|
let t = new ArrayBuffer(e.length), n = new Uint8Array(t);
|
|
2637
2632
|
for (let t = 0, r = e.length; t < r; t++) n[t] = e.charCodeAt(t);
|
|
2638
2633
|
return new Uint8Array(t);
|
|
2639
2634
|
}
|
|
2640
2635
|
//#endregion
|
|
2641
2636
|
//#region ../../libs/media/src/mp4/box-types.ts
|
|
2642
|
-
var
|
|
2643
|
-
ftyp:
|
|
2644
|
-
mvhd:
|
|
2645
|
-
moov:
|
|
2646
|
-
trak:
|
|
2647
|
-
tkhd:
|
|
2648
|
-
mdia:
|
|
2649
|
-
mdhd:
|
|
2650
|
-
hdlr:
|
|
2651
|
-
minf:
|
|
2652
|
-
vmhd:
|
|
2653
|
-
smhd:
|
|
2654
|
-
dinf:
|
|
2655
|
-
dref:
|
|
2656
|
-
stbl:
|
|
2657
|
-
stsd:
|
|
2658
|
-
avc1:
|
|
2659
|
-
hvc1:
|
|
2660
|
-
hev1:
|
|
2661
|
-
av01:
|
|
2662
|
-
av1C:
|
|
2663
|
-
avcC:
|
|
2664
|
-
hvcC:
|
|
2665
|
-
esds:
|
|
2666
|
-
colr:
|
|
2667
|
-
nclx:
|
|
2668
|
-
mvex:
|
|
2669
|
-
trex:
|
|
2670
|
-
udta:
|
|
2671
|
-
meta:
|
|
2672
|
-
ilst:
|
|
2673
|
-
moof:
|
|
2674
|
-
mfhd:
|
|
2675
|
-
traf:
|
|
2676
|
-
tfhd:
|
|
2677
|
-
tfdt:
|
|
2678
|
-
trun:
|
|
2679
|
-
mdat:
|
|
2680
|
-
mp4a:
|
|
2681
|
-
Opus:
|
|
2682
|
-
prft:
|
|
2683
|
-
dOps:
|
|
2684
|
-
emsg:
|
|
2685
|
-
},
|
|
2686
|
-
vide:
|
|
2687
|
-
soun:
|
|
2688
|
-
videoHandler:
|
|
2689
|
-
soundHandler:
|
|
2690
|
-
url:
|
|
2691
|
-
pasp:
|
|
2692
|
-
btrt:
|
|
2693
|
-
stts:
|
|
2694
|
-
stsc:
|
|
2695
|
-
stsz:
|
|
2696
|
-
stco:
|
|
2697
|
-
data:
|
|
2698
|
-
mdir:
|
|
2699
|
-
appl:
|
|
2700
|
-
},
|
|
2637
|
+
var B = {
|
|
2638
|
+
ftyp: z("ftyp"),
|
|
2639
|
+
mvhd: z("mvhd"),
|
|
2640
|
+
moov: z("moov"),
|
|
2641
|
+
trak: z("trak"),
|
|
2642
|
+
tkhd: z("tkhd"),
|
|
2643
|
+
mdia: z("mdia"),
|
|
2644
|
+
mdhd: z("mdhd"),
|
|
2645
|
+
hdlr: z("hdlr"),
|
|
2646
|
+
minf: z("minf"),
|
|
2647
|
+
vmhd: z("vmhd"),
|
|
2648
|
+
smhd: z("smhd"),
|
|
2649
|
+
dinf: z("dinf"),
|
|
2650
|
+
dref: z("dref"),
|
|
2651
|
+
stbl: z("stbl"),
|
|
2652
|
+
stsd: z("stsd"),
|
|
2653
|
+
avc1: z("avc1"),
|
|
2654
|
+
hvc1: z("hvc1"),
|
|
2655
|
+
hev1: z("hev1"),
|
|
2656
|
+
av01: z("av01"),
|
|
2657
|
+
av1C: z("av1C"),
|
|
2658
|
+
avcC: z("avcC"),
|
|
2659
|
+
hvcC: z("hvcC"),
|
|
2660
|
+
esds: z("esds"),
|
|
2661
|
+
colr: z("colr"),
|
|
2662
|
+
nclx: z("nclx"),
|
|
2663
|
+
mvex: z("mvex"),
|
|
2664
|
+
trex: z("trex"),
|
|
2665
|
+
udta: z("udta"),
|
|
2666
|
+
meta: z("meta"),
|
|
2667
|
+
ilst: z("ilst"),
|
|
2668
|
+
moof: z("moof"),
|
|
2669
|
+
mfhd: z("mfhd"),
|
|
2670
|
+
traf: z("traf"),
|
|
2671
|
+
tfhd: z("tfhd"),
|
|
2672
|
+
tfdt: z("tfdt"),
|
|
2673
|
+
trun: z("trun"),
|
|
2674
|
+
mdat: z("mdat"),
|
|
2675
|
+
mp4a: z("mp4a"),
|
|
2676
|
+
Opus: z("Opus"),
|
|
2677
|
+
prft: z("prft"),
|
|
2678
|
+
dOps: z("dOps"),
|
|
2679
|
+
emsg: z("emsg")
|
|
2680
|
+
}, ba = 1e3, V = {
|
|
2681
|
+
vide: z("vide"),
|
|
2682
|
+
soun: z("soun"),
|
|
2683
|
+
videoHandler: z("VideoHandler\0"),
|
|
2684
|
+
soundHandler: z("SoundHandler\0"),
|
|
2685
|
+
url: z("url "),
|
|
2686
|
+
pasp: z("pasp"),
|
|
2687
|
+
btrt: z("btrt"),
|
|
2688
|
+
stts: z("stts"),
|
|
2689
|
+
stsc: z("stsc"),
|
|
2690
|
+
stsz: z("stsz"),
|
|
2691
|
+
stco: z("stco"),
|
|
2692
|
+
data: z("data"),
|
|
2693
|
+
mdir: z("mdir"),
|
|
2694
|
+
appl: z("appl")
|
|
2695
|
+
}, xa = z("iso6"), Sa = new Uint8Array([
|
|
2701
2696
|
0,
|
|
2702
2697
|
0,
|
|
2703
2698
|
2,
|
|
2704
2699
|
0
|
|
2705
|
-
]),
|
|
2706
|
-
|
|
2700
|
+
]), Ca = [
|
|
2701
|
+
xa,
|
|
2707
2702
|
new Uint8Array([
|
|
2708
2703
|
105,
|
|
2709
2704
|
115,
|
|
@@ -2728,8 +2723,8 @@ var V = {
|
|
|
2728
2723
|
52,
|
|
2729
2724
|
49
|
|
2730
2725
|
])
|
|
2731
|
-
],
|
|
2732
|
-
|
|
2726
|
+
], wa = [
|
|
2727
|
+
xa,
|
|
2733
2728
|
new Uint8Array([
|
|
2734
2729
|
105,
|
|
2735
2730
|
115,
|
|
@@ -2754,8 +2749,8 @@ var V = {
|
|
|
2754
2749
|
52,
|
|
2755
2750
|
49
|
|
2756
2751
|
])
|
|
2757
|
-
],
|
|
2758
|
-
|
|
2752
|
+
], Ta = [
|
|
2753
|
+
xa,
|
|
2759
2754
|
new Uint8Array([
|
|
2760
2755
|
105,
|
|
2761
2756
|
115,
|
|
@@ -2780,8 +2775,8 @@ var V = {
|
|
|
2780
2775
|
52,
|
|
2781
2776
|
49
|
|
2782
2777
|
])
|
|
2783
|
-
],
|
|
2784
|
-
|
|
2778
|
+
], Ea = [
|
|
2779
|
+
xa,
|
|
2785
2780
|
new Uint8Array([
|
|
2786
2781
|
105,
|
|
2787
2782
|
115,
|
|
@@ -2800,22 +2795,22 @@ var V = {
|
|
|
2800
2795
|
52,
|
|
2801
2796
|
49
|
|
2802
2797
|
])
|
|
2803
|
-
],
|
|
2798
|
+
], Da = class {
|
|
2804
2799
|
constructor(t) {
|
|
2805
2800
|
e(this, "writer", void 0), e(this, "moofOffset", 0), this.writer = new Pe(t);
|
|
2806
2801
|
}
|
|
2807
|
-
},
|
|
2802
|
+
}, H = (e, t, n) => {
|
|
2808
2803
|
e.writer.writeUint32(n + 8), e.writer.writeBytes(t);
|
|
2809
|
-
},
|
|
2810
|
-
|
|
2811
|
-
},
|
|
2812
|
-
|
|
2813
|
-
},
|
|
2814
|
-
|
|
2815
|
-
let i = n / 1e3, a = Math.floor(i), o = (i - a) * 1e3 * 1e3 *
|
|
2816
|
-
e.writer.writeUint32(t), e.writer.writeUint32(a +
|
|
2817
|
-
},
|
|
2818
|
-
|
|
2804
|
+
}, U = (e, t, n, r, i) => {
|
|
2805
|
+
H(e, t, n + 4), e.writer.writeUint8(r), e.writer.writeUint24(i);
|
|
2806
|
+
}, Oa = (e, t) => {
|
|
2807
|
+
H(e, B.ftyp, xa.byteLength + Sa.byteLength + t.reduce((e, t) => e + t.byteLength, 0)), e.writer.writeBytes(xa), e.writer.writeBytes(Sa), t.forEach((t) => e.writer.writeBytes(t));
|
|
2808
|
+
}, ka = 2 ** 32, Aa = 2208988800, ja = (e, t, n, r) => {
|
|
2809
|
+
U(e, B.prft, 20, 1, 0);
|
|
2810
|
+
let i = n / 1e3, a = Math.floor(i), o = (i - a) * 1e3 * 1e3 * ka / 1e6;
|
|
2811
|
+
e.writer.writeUint32(t), e.writer.writeUint32(a + Aa), e.writer.writeUint32(o), e.writer.writeUint64(r);
|
|
2812
|
+
}, Ma = (e, t, n) => {
|
|
2813
|
+
U(e, B.mvhd, 96, 0, 0), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint32(n), e.writer.writeUint32(t), e.writer.writeUint32(65536), e.writer.writeUint16(256), e.writer.writeBytes(new Uint8Array([
|
|
2819
2814
|
0,
|
|
2820
2815
|
0,
|
|
2821
2816
|
0,
|
|
@@ -2887,9 +2882,9 @@ var V = {
|
|
|
2887
2882
|
0,
|
|
2888
2883
|
0
|
|
2889
2884
|
])), e.writer.writeUint32(2);
|
|
2890
|
-
},
|
|
2885
|
+
}, Na = (e) => "sequenceParameterSets" in e, Pa = (e) => "sequenceHeader" in e, Fa = (e) => "hvcC" in e, Ia = (e) => e.type === "video", La = (e) => e.type === "audio", Ra = (e, t, n) => {
|
|
2891
2886
|
let r = e.writer.position();
|
|
2892
|
-
|
|
2887
|
+
U(e, B.tkhd, 0, 0, 3), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint32(t.trackId), e.writer.writeUint32(0), e.writer.writeUint32(t.duration * n / t.timescale), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint16(0), e.writer.writeUint16(La(t) ? 1 : 0), e.writer.writeUint16(La(t) ? 256 : 0), e.writer.writeUint16(0), e.writer.writeBytes(new Uint8Array([
|
|
2893
2888
|
0,
|
|
2894
2889
|
1,
|
|
2895
2890
|
0,
|
|
@@ -2926,148 +2921,148 @@ var V = {
|
|
|
2926
2921
|
0,
|
|
2927
2922
|
0,
|
|
2928
2923
|
0
|
|
2929
|
-
])),
|
|
2930
|
-
},
|
|
2931
|
-
|
|
2924
|
+
])), Ia(t) ? (e.writer.writeUint32(t.width * 65536), e.writer.writeUint32(t.height * 65536)) : La(t) && (e.writer.writeUint32(0), e.writer.writeUint32(0)), e.writer.writeUint32At(r, e.writer.position() - r);
|
|
2925
|
+
}, za = (e, t) => {
|
|
2926
|
+
U(e, B.mdhd, 20, 0, 0), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint32(t.timescale), e.writer.writeUint32(t.duration);
|
|
2932
2927
|
let n = t.lang || "und", r = (n.charCodeAt(0) & 31) << 10 | (n.charCodeAt(1) & 31) << 5 | n.charCodeAt(2) & 31;
|
|
2933
2928
|
e.writer.writeUint16(r), e.writer.writeUint16(0);
|
|
2934
|
-
},
|
|
2929
|
+
}, Ba = (e, t) => {
|
|
2935
2930
|
let n = e.writer.position();
|
|
2936
|
-
|
|
2937
|
-
},
|
|
2931
|
+
U(e, B.hdlr, 0, 0, 0), e.writer.writeUint32(0), e.writer.writeBytes(Ia(t) ? V.vide : V.soun), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeBytes(Ia(t) ? V.videoHandler : V.soundHandler), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2932
|
+
}, Va = (e) => {
|
|
2938
2933
|
let t = e.writer.position();
|
|
2939
|
-
|
|
2940
|
-
},
|
|
2934
|
+
H(e, B.dinf, 0), U(e, B.dref, 16, 0, 0), e.writer.writeUint32(1), U(e, V.url, 0, 0, 1), e.writer.writeUint32At(t, e.writer.position() - t);
|
|
2935
|
+
}, Ha = (e, t) => {
|
|
2941
2936
|
let n = e.writer.position();
|
|
2942
|
-
|
|
2937
|
+
H(e, B.avcC, 0), e.writer.writeUint8(1), e.writer.writeUint8(t.sequenceParameterSets[0][1]), e.writer.writeUint8(t.sequenceParameterSets[0][2]), e.writer.writeUint8(t.sequenceParameterSets[0][3]), e.writer.writeUint8(255), e.writer.writeUint8(224 | t.sequenceParameterSets.length), t.sequenceParameterSets.forEach((t) => {
|
|
2943
2938
|
e.writer.writeUint16(t.byteLength), e.writer.writeBytes(t);
|
|
2944
2939
|
}), e.writer.writeUint8(t.pictureParameterSets.length), t.pictureParameterSets.forEach((t) => {
|
|
2945
2940
|
e.writer.writeUint16(t.byteLength), e.writer.writeBytes(t);
|
|
2946
2941
|
}), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2947
|
-
},
|
|
2942
|
+
}, Ua = (e, t) => {
|
|
2948
2943
|
var n, r;
|
|
2949
2944
|
let i = e.writer.position();
|
|
2950
|
-
|
|
2945
|
+
H(e, B.av1C, 0);
|
|
2951
2946
|
let { seqProfile: a, operatingPoints: o, colorConfig: s } = t.parsedSequenceHeader, c = o[0];
|
|
2952
2947
|
e.writer.writeUint8(129), e.writer.writeUint8(a << 5 | ((n = c == null ? void 0 : c.seqLevelIdx) == null ? 0 : n)), e.writer.writeUint8(((r = c == null ? void 0 : c.tier) == null ? 0 : r) | (s.highBitDepth ? 1 : 0) | (s.bitDepth === 12 ? 1 : 0) << 5 | (s.monoChrome ? 1 : 0) << 4 | s.subsamplingX << 3 | s.subsamplingY << 2 | s.chromaSamplePosition & 65535), e.writer.writeUint8(0), e.writer.writeBytes(t.sequenceHeader), e.writer.writeUint32At(i, e.writer.position() - i);
|
|
2953
|
-
}, Ua = (e, t) => {
|
|
2954
|
-
let n = e.writer.position();
|
|
2955
|
-
U(e, V.hvcC, 0), e.writer.writeBytes(t.hvcC), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2956
2948
|
}, Wa = (e, t) => {
|
|
2957
2949
|
let n = e.writer.position();
|
|
2958
|
-
|
|
2959
|
-
}, Ga = (e, t
|
|
2950
|
+
H(e, B.hvcC, 0), e.writer.writeBytes(t.hvcC), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2951
|
+
}, Ga = (e, t) => {
|
|
2952
|
+
let n = e.writer.position();
|
|
2953
|
+
H(e, Pa(t) ? B.av01 : Fa(t) ? B.hvc1 : B.avc1, 0), e.writer.writeUint32(0), e.writer.writeUint16(0), e.writer.writeUint16(1), e.writer.writeUint16(0), e.writer.writeUint16(0), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint16(t.width), e.writer.writeUint16(t.height), e.writer.writeUint32(4718592), e.writer.writeUint32(4718592), e.writer.writeUint32(0), e.writer.writeUint16(1), e.writer.writeUint8(0), e.writer.writeBytes(new Uint8Array(31)), e.writer.writeUint16(24), e.writer.writeUint16(-1), Na(t) ? Ha(e, t) : Pa(t) ? (Ua(e, t), t.parsedSequenceHeader.colorConfig && (H(e, B.colr, 11), e.writer.writeBytes(B.nclx), e.writer.writeUint16(t.parsedSequenceHeader.colorConfig.colorPrimaries), e.writer.writeUint16(t.parsedSequenceHeader.colorConfig.transferCharacteristics), e.writer.writeUint16(t.parsedSequenceHeader.colorConfig.matrixCoefficients), e.writer.writeUint8(t.parsedSequenceHeader.colorConfig.colorRange ? 1 : 0))) : Fa(t) && Wa(e, t), t.pixelAspectRatio && (H(e, V.pasp, 8), e.writer.writeUint32(t.pixelAspectRatio.numerator), e.writer.writeUint32(t.pixelAspectRatio.denumerator)), t.bitrate && (H(e, V.btrt, 12), e.writer.writeUint32(0), e.writer.writeUint32(t.bitrate), e.writer.writeUint32(t.bitrate)), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2954
|
+
}, Ka = (e, t, n) => {
|
|
2960
2955
|
let r = 3;
|
|
2961
2956
|
for (e.writer.writeUint8(t); r > 0; r--) e.writer.writeUint8(n >> 7 * r | 128);
|
|
2962
2957
|
e.writer.writeUint8(n & 127);
|
|
2963
|
-
},
|
|
2958
|
+
}, qa = (e, t) => {
|
|
2964
2959
|
let n = t.decoderConfig.byteLength > 0 ? t.decoderConfig.byteLength + 5 : 0, r = e.writer.position();
|
|
2965
|
-
|
|
2960
|
+
U(e, B.esds, 0, 0, 0), Ka(e, 3, 21 + n + 5 + 1), e.writer.writeUint16(t.trackId), e.writer.writeUint8(0), Ka(e, 4, 13 + n);
|
|
2966
2961
|
let i = t.codec === "mp3" && t.sampleRate > 24e3 ? 107 : 64;
|
|
2967
|
-
e.writer.writeUint8(i), e.writer.writeUint8(21), e.writer.writeUint24(0), e.writer.writeUint32(t.bitrate || 0), e.writer.writeUint32(t.bitrate || 0), t.decoderConfig.byteLength > 0 && (
|
|
2968
|
-
},
|
|
2962
|
+
e.writer.writeUint8(i), e.writer.writeUint8(21), e.writer.writeUint24(0), e.writer.writeUint32(t.bitrate || 0), e.writer.writeUint32(t.bitrate || 0), t.decoderConfig.byteLength > 0 && (Ka(e, 5, t.decoderConfig.byteLength), e.writer.writeBytes(t.decoderConfig)), Ka(e, 6, 1), e.writer.writeUint8(2), e.writer.writeUint32At(r, e.writer.position() - r);
|
|
2963
|
+
}, Ja = (e) => {
|
|
2969
2964
|
switch (e) {
|
|
2970
2965
|
case "aac":
|
|
2971
|
-
case "mp3": return
|
|
2972
|
-
case "opus": return
|
|
2966
|
+
case "mp3": return B.mp4a;
|
|
2967
|
+
case "opus": return B.Opus;
|
|
2973
2968
|
}
|
|
2974
|
-
},
|
|
2969
|
+
}, Ya = (e, t) => {
|
|
2975
2970
|
let n = e.writer.position();
|
|
2976
|
-
|
|
2971
|
+
H(e, B.dOps, 0), e.writer.writeUint8(0);
|
|
2977
2972
|
let r = t.decoderConfig, i = new DataView(r.buffer, r.byteOffset, r.byteLength);
|
|
2978
2973
|
e.writer.writeUint8(i.getUint8(9)), e.writer.writeUint16(i.getUint16(10, !0)), e.writer.writeUint32(i.getUint32(12, !0)), e.writer.writeUint16(i.getUint16(16, !0)), e.writer.writeBytes(t.decoderConfig.slice(18)), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2979
|
-
},
|
|
2974
|
+
}, Xa = (e, t) => {
|
|
2980
2975
|
let n = e.writer.position();
|
|
2981
|
-
switch (
|
|
2976
|
+
switch (H(e, Ja(t.codec), 0), e.writer.writeUint32(0), e.writer.writeUint16(0), e.writer.writeUint16(1), e.writer.writeUint16(0), e.writer.writeUint16(0), e.writer.writeUint32(0), e.writer.writeUint16(t.channelCount), e.writer.writeUint16(16), e.writer.writeUint32(0), e.writer.writeUint16(t.sampleRate), e.writer.writeUint16(0), t.codec) {
|
|
2982
2977
|
case "aac":
|
|
2983
2978
|
case "mp3":
|
|
2984
|
-
|
|
2979
|
+
qa(e, t);
|
|
2985
2980
|
break;
|
|
2986
2981
|
case "opus":
|
|
2987
|
-
|
|
2982
|
+
Ya(e, t);
|
|
2988
2983
|
break;
|
|
2989
2984
|
}
|
|
2990
|
-
t.bitrate && (
|
|
2991
|
-
}, Xa = (e, t) => {
|
|
2992
|
-
let n = e.writer.position();
|
|
2993
|
-
U(e, V.stbl, 0);
|
|
2994
|
-
let r = e.writer.position();
|
|
2995
|
-
W(e, V.stsd, 0, 0, 0), e.writer.writeUint32(1), Fa(t) ? Wa(e, t) : Ia(t) && Ya(e, t), e.writer.writeUint32At(r, e.writer.position() - r), W(e, H.stts, 4, 0, 0), e.writer.writeUint32(0), W(e, H.stsc, 4, 0, 0), e.writer.writeUint32(0), W(e, H.stsz, 8, 0, 0), e.writer.writeUint32(0), e.writer.writeUint32(0), W(e, H.stco, 4, 0, 0), e.writer.writeUint32(0), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2985
|
+
t.bitrate && (H(e, V.btrt, 12), e.writer.writeUint32(0), e.writer.writeUint32(t.bitrate), e.writer.writeUint32(t.bitrate)), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2996
2986
|
}, Za = (e, t) => {
|
|
2997
2987
|
let n = e.writer.position();
|
|
2998
|
-
|
|
2988
|
+
H(e, B.stbl, 0);
|
|
2989
|
+
let r = e.writer.position();
|
|
2990
|
+
U(e, B.stsd, 0, 0, 0), e.writer.writeUint32(1), Ia(t) ? Ga(e, t) : La(t) && Xa(e, t), e.writer.writeUint32At(r, e.writer.position() - r), U(e, V.stts, 4, 0, 0), e.writer.writeUint32(0), U(e, V.stsc, 4, 0, 0), e.writer.writeUint32(0), U(e, V.stsz, 8, 0, 0), e.writer.writeUint32(0), e.writer.writeUint32(0), U(e, V.stco, 4, 0, 0), e.writer.writeUint32(0), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2999
2991
|
}, Qa = (e, t) => {
|
|
3000
2992
|
let n = e.writer.position();
|
|
3001
|
-
|
|
3002
|
-
}, $a = (e, t
|
|
2993
|
+
H(e, B.minf, 0), Ia(t) ? (U(e, B.vmhd, 8, 0, 1), e.writer.writeUint32(0), e.writer.writeUint32(0)) : La(t) && (U(e, B.smhd, 4, 0, 0), e.writer.writeUint16(0), e.writer.writeUint16(0)), Va(e), Za(e, t), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2994
|
+
}, $a = (e, t) => {
|
|
2995
|
+
let n = e.writer.position();
|
|
2996
|
+
H(e, B.mdia, 0), za(e, t), Ba(e, t), Qa(e, t), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
2997
|
+
}, eo = (e, t, n) => {
|
|
3003
2998
|
let r = e.writer.position();
|
|
3004
|
-
|
|
3005
|
-
}, eo = (e, t) => {
|
|
3006
|
-
W(e, V.trex, 20, 0, 0), e.writer.writeUint32(t.trackId), e.writer.writeUint32(1), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint32(0);
|
|
2999
|
+
H(e, B.trak, 0), Ra(e, t, n), $a(e, t), e.writer.writeUint32At(r, e.writer.position() - r);
|
|
3007
3000
|
}, to = (e, t) => {
|
|
3001
|
+
U(e, B.trex, 20, 0, 0), e.writer.writeUint32(t.trackId), e.writer.writeUint32(1), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint32(0);
|
|
3002
|
+
}, no = (e, t) => {
|
|
3008
3003
|
let n = e.writer.position();
|
|
3009
|
-
|
|
3010
|
-
},
|
|
3004
|
+
H(e, B.mvex, 0), t.forEach((t) => to(e, t)), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
3005
|
+
}, ro = (e, t, n) => {
|
|
3011
3006
|
let r = e.writer.position();
|
|
3012
|
-
|
|
3013
|
-
},
|
|
3007
|
+
H(e, z(t), 0), H(e, V.data, 0), e.writer.writeUint32(1), e.writer.writeUint32(0), e.writer.writeBytes(z(n)), e.writer.writeUint32At(r, e.writer.position() - r), e.writer.writeUint32At(r + 8, e.writer.position() - r - 8);
|
|
3008
|
+
}, io = (e, t) => {
|
|
3014
3009
|
let n = e.writer.position();
|
|
3015
|
-
|
|
3010
|
+
U(e, B.meta, 0, 0, 0);
|
|
3016
3011
|
let r = e.writer.position();
|
|
3017
|
-
|
|
3012
|
+
H(e, B.hdlr, 25), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeBytes(V.mdir), e.writer.writeBytes(V.appl), e.writer.writeUint32(0), e.writer.writeUint32(0), e.writer.writeUint8(0), e.writer.writeUint32At(r, e.writer.position() - r);
|
|
3018
3013
|
let i = e.writer.position();
|
|
3019
|
-
|
|
3020
|
-
},
|
|
3014
|
+
H(e, B.ilst, 0), t == null || t.forEach((t, n) => ro(e, n, t)), e.writer.writeUint32At(i, e.writer.position() - i), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
3015
|
+
}, ao = (e, t) => {
|
|
3021
3016
|
let n = e.writer.position();
|
|
3022
|
-
|
|
3023
|
-
},
|
|
3017
|
+
H(e, B.udta, 0), io(e, t), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
3018
|
+
}, oo = (e, t, n, r) => {
|
|
3024
3019
|
let i = e.writer.position();
|
|
3025
|
-
|
|
3026
|
-
}, oo = (e, t) => {
|
|
3027
|
-
let n = e.writer.position();
|
|
3028
|
-
W(e, V.tfhd, 16, 0, 56), e.writer.writeUint32(t.trackId), e.writer.writeUint32(t.defaultDuration || 0), e.writer.writeUint32(t.defaultSize || 0), e.writer.writeUint32(t.defaultFlags || 0), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
3020
|
+
H(e, B.moov, 0), Ma(e, 0, n), t.forEach((t) => eo(e, t, n)), no(e, t), r && ao(e, r), e.writer.writeUint32At(i, e.writer.position() - i);
|
|
3029
3021
|
}, so = (e, t) => {
|
|
3030
3022
|
let n = e.writer.position();
|
|
3031
|
-
|
|
3023
|
+
U(e, B.tfhd, 16, 0, 56), e.writer.writeUint32(t.trackId), e.writer.writeUint32(t.defaultDuration || 0), e.writer.writeUint32(t.defaultSize || 0), e.writer.writeUint32(t.defaultFlags || 0), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
3024
|
+
}, co = (e, t) => {
|
|
3025
|
+
let n = e.writer.position();
|
|
3026
|
+
U(e, B.tfdt, 8, 1, 0);
|
|
3032
3027
|
let r = Math.floor(t.timestamp / 4294967296), i = (t.timestamp & 4294967295) >>> 0;
|
|
3033
3028
|
e.writer.writeUint32(r), e.writer.writeUint32(i), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
3034
|
-
},
|
|
3029
|
+
}, lo = (e, t) => {
|
|
3035
3030
|
if (!t.samples[0]) throw Error("At least one sample must be provided");
|
|
3036
|
-
let n = t.samples.some((e) => !!e.compositionTimeOffset), r =
|
|
3031
|
+
let n = t.samples.some((e) => !!e.compositionTimeOffset), r = uo(t.samples[0]) !== t.defaultFlags, i = t.samples.length > 1, a = 1;
|
|
3037
3032
|
r && (a |= 4), n && (a |= 2048), i && (a |= 512, a |= 256, a |= 1024);
|
|
3038
3033
|
let o = e.writer.position();
|
|
3039
|
-
|
|
3034
|
+
U(e, B.trun, 16, 1, a), e.writer.writeUint32(t.samples.length);
|
|
3040
3035
|
let s = e.writer.position();
|
|
3041
|
-
e.writer.writeUint32(0), r && e.writer.writeUint32(
|
|
3042
|
-
for (let r of t.samples) i && (e.writer.writeUint32(r.duration), e.writer.writeUint32(r.data.byteLength), e.writer.writeUint32(
|
|
3036
|
+
e.writer.writeUint32(0), r && e.writer.writeUint32(uo(t.samples[0]));
|
|
3037
|
+
for (let r of t.samples) i && (e.writer.writeUint32(r.duration), e.writer.writeUint32(r.data.byteLength), e.writer.writeUint32(uo(r))), n && e.writer.writeUint32(r.compositionTimeOffset || 0);
|
|
3043
3038
|
e.writer.writeUint32At(s, e.writer.position() - e.moofOffset + 8), e.writer.writeUint32At(o, e.writer.position() - o);
|
|
3044
|
-
},
|
|
3039
|
+
}, uo = (e) => e.isSync ? 33554432 : 16842752, fo = (e, t) => {
|
|
3045
3040
|
let n = e.writer.position();
|
|
3046
|
-
|
|
3047
|
-
}, fo = (e, t) => {
|
|
3048
|
-
W(e, V.mfhd, 4, 0, 0), e.writer.writeUint32(t);
|
|
3041
|
+
H(e, B.traf, 0), so(e, t), co(e, t), lo(e, t), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
3049
3042
|
}, po = (e, t) => {
|
|
3043
|
+
U(e, B.mfhd, 4, 0, 0), e.writer.writeUint32(t);
|
|
3044
|
+
}, mo = (e, t) => {
|
|
3050
3045
|
let n = e.writer.position();
|
|
3051
|
-
|
|
3052
|
-
},
|
|
3053
|
-
|
|
3046
|
+
H(e, B.moof, 0), po(e, t.sequenceNumber), fo(e, t), e.writer.writeUint32At(n, e.writer.position() - n);
|
|
3047
|
+
}, ho = (e, t, n) => {
|
|
3048
|
+
H(e, B.mdat, n);
|
|
3054
3049
|
for (let n of t.samples) {
|
|
3055
3050
|
let t = n.data instanceof ArrayBuffer ? new Uint8Array(n.data) : n.data;
|
|
3056
3051
|
e.writer.writeBytes(t);
|
|
3057
3052
|
}
|
|
3058
|
-
},
|
|
3059
|
-
let n = new
|
|
3060
|
-
return e.filter((e) =>
|
|
3061
|
-
},
|
|
3053
|
+
}, go = (e, t) => {
|
|
3054
|
+
let n = new Da(), r = e.filter((e) => Ia(e) && Na(e)).length > 0, i = e.filter((e) => Ia(e) && Fa(e)).length > 0;
|
|
3055
|
+
return e.filter((e) => Ia(e) && Pa(e)).length > 0 ? Oa(n, Ta) : i ? Oa(n, wa) : r ? Oa(n, Ca) : Oa(n, Ea), oo(n, e, ba, t), n.writer.buffer();
|
|
3056
|
+
}, _o = (e) => {
|
|
3062
3057
|
var t;
|
|
3063
3058
|
let n = 0;
|
|
3064
3059
|
for (let t of e.samples) n += t.data.byteLength;
|
|
3065
|
-
let r = new
|
|
3066
|
-
return ((t = e.samples[0]) == null ? void 0 : t.producerReferenceTime) !== void 0 &&
|
|
3067
|
-
},
|
|
3060
|
+
let r = new Da(n + 256);
|
|
3061
|
+
return ((t = e.samples[0]) == null ? void 0 : t.producerReferenceTime) !== void 0 && ja(r, e.trackId, e.samples[0].producerReferenceTime, e.timestamp), r.moofOffset = r.writer.position(), mo(r, e), ho(r, e, n), r.writer.bufferExact();
|
|
3062
|
+
}, vo = (e, t) => {
|
|
3068
3063
|
let n = e[0];
|
|
3069
3064
|
if (!n) throw Error("At least one sample must be provided");
|
|
3070
|
-
return
|
|
3065
|
+
return _o({
|
|
3071
3066
|
trackId: 1,
|
|
3072
3067
|
timestamp: n.timestamp,
|
|
3073
3068
|
sequenceNumber: t,
|
|
@@ -3076,7 +3071,7 @@ var V = {
|
|
|
3076
3071
|
defaultDuration: n.duration,
|
|
3077
3072
|
samples: e
|
|
3078
3073
|
});
|
|
3079
|
-
},
|
|
3074
|
+
}, yo = (e, t, n, r) => go([{
|
|
3080
3075
|
type: "audio",
|
|
3081
3076
|
codec: "aac",
|
|
3082
3077
|
decoderConfig: e,
|
|
@@ -3085,14 +3080,14 @@ var V = {
|
|
|
3085
3080
|
timescale: r,
|
|
3086
3081
|
duration: 0,
|
|
3087
3082
|
trackId: 1
|
|
3088
|
-
}]),
|
|
3089
|
-
let { sequenceParameterSets: t, pictureParameterSets: n } =
|
|
3083
|
+
}]), bo = (e) => {
|
|
3084
|
+
let { sequenceParameterSets: t, pictureParameterSets: n } = ai(e), r = t[0], i = n[0];
|
|
3090
3085
|
if (!r || !i) throw Error("No sps or pps provided");
|
|
3091
|
-
return
|
|
3092
|
-
},
|
|
3086
|
+
return oi(r);
|
|
3087
|
+
}, xo = (e, t) => {
|
|
3093
3088
|
let n = e[0];
|
|
3094
3089
|
if (!n) throw Error("At least one sample must be provided");
|
|
3095
|
-
return
|
|
3090
|
+
return _o({
|
|
3096
3091
|
trackId: 1,
|
|
3097
3092
|
timestamp: n.timestamp,
|
|
3098
3093
|
sequenceNumber: t,
|
|
@@ -3101,9 +3096,9 @@ var V = {
|
|
|
3101
3096
|
defaultDuration: n.duration,
|
|
3102
3097
|
samples: e
|
|
3103
3098
|
});
|
|
3104
|
-
},
|
|
3105
|
-
let { sequenceParameterSets: n, pictureParameterSets: r } =
|
|
3106
|
-
return
|
|
3099
|
+
}, So = (e, t) => {
|
|
3100
|
+
let { sequenceParameterSets: n, pictureParameterSets: r } = ai(e), i = bo(e);
|
|
3101
|
+
return go([{
|
|
3107
3102
|
type: "video",
|
|
3108
3103
|
sequenceParameterSets: n.map((e) => new Uint8Array(e)),
|
|
3109
3104
|
pictureParameterSets: r.map((e) => new Uint8Array(e)),
|
|
@@ -3113,10 +3108,10 @@ var V = {
|
|
|
3113
3108
|
duration: 0,
|
|
3114
3109
|
trackId: 1
|
|
3115
3110
|
}]);
|
|
3116
|
-
},
|
|
3111
|
+
}, Co = (e, t) => {
|
|
3117
3112
|
let n = e[0];
|
|
3118
3113
|
if (!n) throw Error("At least one sample must be provided");
|
|
3119
|
-
return
|
|
3114
|
+
return _o({
|
|
3120
3115
|
trackId: 1,
|
|
3121
3116
|
timestamp: n.timestamp,
|
|
3122
3117
|
sequenceNumber: t,
|
|
@@ -3125,7 +3120,7 @@ var V = {
|
|
|
3125
3120
|
defaultDuration: n.duration,
|
|
3126
3121
|
samples: e
|
|
3127
3122
|
});
|
|
3128
|
-
},
|
|
3123
|
+
}, wo = (e, t, n, r) => go([{
|
|
3129
3124
|
type: "video",
|
|
3130
3125
|
hvcC: new Uint8Array(e),
|
|
3131
3126
|
width: n,
|
|
@@ -3133,7 +3128,7 @@ var V = {
|
|
|
3133
3128
|
timescale: t,
|
|
3134
3129
|
duration: 0,
|
|
3135
3130
|
trackId: 1
|
|
3136
|
-
}]),
|
|
3131
|
+
}]), To = (e, t, n) => go([{
|
|
3137
3132
|
type: "audio",
|
|
3138
3133
|
trackId: 1,
|
|
3139
3134
|
channelCount: t,
|
|
@@ -3142,10 +3137,10 @@ var V = {
|
|
|
3142
3137
|
decoderConfig: e,
|
|
3143
3138
|
duration: 0,
|
|
3144
3139
|
sampleRate: 48e3
|
|
3145
|
-
}]),
|
|
3140
|
+
}]), Eo = (e, t) => {
|
|
3146
3141
|
let n = e[0];
|
|
3147
3142
|
if (!n) throw Error("At least one sample must be provided");
|
|
3148
|
-
return
|
|
3143
|
+
return _o({
|
|
3149
3144
|
trackId: 1,
|
|
3150
3145
|
timestamp: n.timestamp,
|
|
3151
3146
|
sequenceNumber: t,
|
|
@@ -3154,7 +3149,7 @@ var V = {
|
|
|
3154
3149
|
defaultDuration: n.duration,
|
|
3155
3150
|
samples: e
|
|
3156
3151
|
});
|
|
3157
|
-
},
|
|
3152
|
+
}, Do = (e) => {
|
|
3158
3153
|
if (e.length <= 78) return;
|
|
3159
3154
|
let t = 78;
|
|
3160
3155
|
for (; t + 8 <= e.length;) {
|
|
@@ -3165,45 +3160,45 @@ var V = {
|
|
|
3165
3160
|
}
|
|
3166
3161
|
};
|
|
3167
3162
|
Symbol.iterator;
|
|
3168
|
-
var
|
|
3163
|
+
var Oo = (e) => {
|
|
3169
3164
|
let t = new ke(e);
|
|
3170
|
-
return t.peekBit() === 1 && t.readBits(32),
|
|
3171
|
-
},
|
|
3165
|
+
return t.peekBit() === 1 && t.readBits(32), jo(t), Ho(t);
|
|
3166
|
+
}, ko = (e) => {
|
|
3172
3167
|
let t = 0, n = 0;
|
|
3173
3168
|
for (let r = 0; r < 8; r++) {
|
|
3174
3169
|
let i = e.readBits(8);
|
|
3175
3170
|
if (t |= (i & 127) << r * 7, n += 1, (i & 128) != 128) break;
|
|
3176
3171
|
}
|
|
3177
3172
|
return [n, t];
|
|
3178
|
-
},
|
|
3173
|
+
}, Ao = (e) => {
|
|
3179
3174
|
let t = 0;
|
|
3180
3175
|
for (; t < 100 && e.readBit() === 0;) t++;
|
|
3181
3176
|
return t >= 32 ? 0 : e.readBits(t) + (1 << t) - 1;
|
|
3182
|
-
},
|
|
3177
|
+
}, jo = (e) => {
|
|
3183
3178
|
let t = e.remainingBits() / 8, n = e.readBits(8);
|
|
3184
3179
|
if (n >> 7 & 1) return;
|
|
3185
3180
|
let r = n >> 3 & 15, i = n >> 2 & 1, a = n >> 1 & 1;
|
|
3186
3181
|
i === 1 && e.readBits(8);
|
|
3187
|
-
let [o, s] = a ?
|
|
3182
|
+
let [o, s] = a ? ko(e) : [0, t];
|
|
3188
3183
|
return {
|
|
3189
3184
|
headerLength: 1 + i + o,
|
|
3190
3185
|
type: r,
|
|
3191
3186
|
obuSize: s
|
|
3192
3187
|
};
|
|
3193
|
-
},
|
|
3188
|
+
}, Mo = (e) => {
|
|
3194
3189
|
let t = e.readBits(32), n = e.readBits(32), r = e.readBit() !== 0, i = 0;
|
|
3195
|
-
return r && (i =
|
|
3190
|
+
return r && (i = Ao(e) + 1), {
|
|
3196
3191
|
timescale: n,
|
|
3197
3192
|
equalPictureInterval: r,
|
|
3198
3193
|
numUnitsInDisplayTick: t,
|
|
3199
3194
|
numTicksPerPicture: i
|
|
3200
3195
|
};
|
|
3201
|
-
},
|
|
3196
|
+
}, No = 2, Po = 2, Fo = 1, Io = 2, Lo = 2, Ro = 13, zo = 0, Bo = 2, Vo = 0, Ho = (e) => {
|
|
3202
3197
|
var t;
|
|
3203
3198
|
let n = e.readBits(3), r = e.readBit() !== 0, i = e.readBit() !== 0, a, o = !1, s = !1, c = !1, l = 0, u = 0, d = [];
|
|
3204
3199
|
if (i) e.readBits(5);
|
|
3205
3200
|
else {
|
|
3206
|
-
if (s = e.readBit() !== 0, s && (a =
|
|
3201
|
+
if (s = e.readBit() !== 0, s && (a = Mo(e), o = e.readBit() !== 0, o)) throw Error("Not implemented");
|
|
3207
3202
|
c = e.readBit() !== 0;
|
|
3208
3203
|
let t = e.readBits(5) + 1;
|
|
3209
3204
|
for (let n = 0; n < t; n++) {
|
|
@@ -3218,8 +3213,8 @@ var Do = (e) => {
|
|
|
3218
3213
|
}
|
|
3219
3214
|
let f = e.readBits(4) + 1, p = e.readBits(4) + 1, m = e.readBits(f) + 1, h = e.readBits(p) + 1, g = !1;
|
|
3220
3215
|
g = i ? !1 : e.readBit() !== 0, g && (l = e.readBits(4) + 2, u = e.readBits(3) + 1);
|
|
3221
|
-
let ee = e.readBit() !== 0, _ = e.readBit() !== 0, v = e.readBit() !== 0, y = !1, te = !1, b = !1, ne = !1, x = !1, S = !1, C = !1, w =
|
|
3222
|
-
i || (y = e.readBit() !== 0, te = e.readBit() !== 0, b = e.readBit() !== 0, ne = e.readBit() !== 0, x = e.readBit() !== 0, x && (S = e.readBit() !== 0, C = e.readBit() !== 0), w = e.readBit() === 0 ? e.readBit() :
|
|
3216
|
+
let ee = e.readBit() !== 0, _ = e.readBit() !== 0, v = e.readBit() !== 0, y = !1, te = !1, b = !1, ne = !1, x = !1, S = !1, C = !1, w = No, T = Po, E = 0;
|
|
3217
|
+
i || (y = e.readBit() !== 0, te = e.readBit() !== 0, b = e.readBit() !== 0, ne = e.readBit() !== 0, x = e.readBit() !== 0, x && (S = e.readBit() !== 0, C = e.readBit() !== 0), w = e.readBit() === 0 ? e.readBit() : No, T = w > 0 ? e.readBit() > 0 ? Po : e.readBit() : Po, E = x ? e.readBits(3) : 0);
|
|
3223
3218
|
let D = e.readBit() !== 0, re = e.readBit() !== 0, ie = e.readBit() !== 0;
|
|
3224
3219
|
return {
|
|
3225
3220
|
seqProfile: n,
|
|
@@ -3258,14 +3253,14 @@ var Do = (e) => {
|
|
|
3258
3253
|
enableSuperres: D,
|
|
3259
3254
|
enableCdef: re,
|
|
3260
3255
|
enableRestoration: ie,
|
|
3261
|
-
colorConfig:
|
|
3256
|
+
colorConfig: Uo(e, n),
|
|
3262
3257
|
filmGrainParamsPresent: e.readBit() !== 0
|
|
3263
3258
|
};
|
|
3264
|
-
},
|
|
3259
|
+
}, Uo = (e, t) => {
|
|
3265
3260
|
let n = e.readBit() !== 0, r = 8, i = !1;
|
|
3266
3261
|
t === 2 && n ? r = e.readBit() === 0 ? 10 : 12 : t <= 2 && (r = n ? 10 : 8), i = t === 1 ? !1 : e.readBit() !== 0;
|
|
3267
|
-
let a = i ? 1 : 3, o = e.readBit() !== 0, s =
|
|
3268
|
-
return o && (s = e.readBits(8), c = e.readBits(8), l = e.readBits(8)), i ? (u = e.readBit() !== 0, d = 1, f = 1, p =
|
|
3262
|
+
let a = i ? 1 : 3, o = e.readBit() !== 0, s = Io, c = Lo, l = Bo, u = !1, d = 0, f = 0, p = Vo, m = !1;
|
|
3263
|
+
return o && (s = e.readBits(8), c = e.readBits(8), l = e.readBits(8)), i ? (u = e.readBit() !== 0, d = 1, f = 1, p = Vo, m = !1, {
|
|
3269
3264
|
highBitDepth: n,
|
|
3270
3265
|
bitDepth: r,
|
|
3271
3266
|
monoChrome: i,
|
|
@@ -3278,7 +3273,7 @@ var Do = (e) => {
|
|
|
3278
3273
|
subsamplingX: d,
|
|
3279
3274
|
subsamplingY: f,
|
|
3280
3275
|
transferCharacteristics: c
|
|
3281
|
-
}) : s ===
|
|
3276
|
+
}) : s === Fo && c === Ro && l === zo ? (u = !0, d = 0, f = 0, {
|
|
3282
3277
|
highBitDepth: n,
|
|
3283
3278
|
bitDepth: r,
|
|
3284
3279
|
monoChrome: i,
|
|
@@ -3305,16 +3300,16 @@ var Do = (e) => {
|
|
|
3305
3300
|
subsamplingY: f,
|
|
3306
3301
|
transferCharacteristics: c
|
|
3307
3302
|
});
|
|
3308
|
-
},
|
|
3309
|
-
let t =
|
|
3303
|
+
}, Wo = (e) => {
|
|
3304
|
+
let t = Oo(e);
|
|
3310
3305
|
if (t) return {
|
|
3311
3306
|
width: t.maxFrameWidth,
|
|
3312
3307
|
height: t.maxFrameHeight
|
|
3313
3308
|
};
|
|
3314
|
-
},
|
|
3309
|
+
}, Go = (e, t) => {
|
|
3315
3310
|
let n = e[0];
|
|
3316
3311
|
if (!n) throw Error("At least one sample must be provided");
|
|
3317
|
-
return
|
|
3312
|
+
return _o({
|
|
3318
3313
|
trackId: 1,
|
|
3319
3314
|
timestamp: n.timestamp,
|
|
3320
3315
|
sequenceNumber: t,
|
|
@@ -3323,10 +3318,10 @@ var Do = (e) => {
|
|
|
3323
3318
|
defaultDuration: n.duration,
|
|
3324
3319
|
samples: e
|
|
3325
3320
|
});
|
|
3326
|
-
},
|
|
3327
|
-
let n =
|
|
3321
|
+
}, Ko = (e, t) => {
|
|
3322
|
+
let n = Oo(e);
|
|
3328
3323
|
if (!n) throw Error("Failed to parse sequence header");
|
|
3329
|
-
return
|
|
3324
|
+
return go([{
|
|
3330
3325
|
type: "video",
|
|
3331
3326
|
parsedSequenceHeader: n,
|
|
3332
3327
|
sequenceHeader: new Uint8Array(e),
|
|
@@ -3336,38 +3331,38 @@ var Do = (e) => {
|
|
|
3336
3331
|
duration: 0,
|
|
3337
3332
|
trackId: 1
|
|
3338
3333
|
}]);
|
|
3339
|
-
},
|
|
3334
|
+
}, qo = (e) => {
|
|
3340
3335
|
let { codec: t, initData: n, timescale: r } = e;
|
|
3341
3336
|
switch (t) {
|
|
3342
|
-
case "h264": return
|
|
3343
|
-
case "h265": return
|
|
3344
|
-
case "av1": return
|
|
3345
|
-
case "opus": return
|
|
3346
|
-
case "aac": return
|
|
3337
|
+
case "h264": return Yo(n, r);
|
|
3338
|
+
case "h265": return Zo(n, r, e.width, e.height);
|
|
3339
|
+
case "av1": return Xo(n, r);
|
|
3340
|
+
case "opus": return Qo(n, r, e.channelCount || 2);
|
|
3341
|
+
case "aac": return $o(n, r, e.channelCount || 2);
|
|
3347
3342
|
default: throw Error(`Failed to initialize ${t} segment`);
|
|
3348
3343
|
}
|
|
3349
|
-
},
|
|
3344
|
+
}, Jo = (e, t) => {
|
|
3350
3345
|
switch (e) {
|
|
3351
|
-
case "h264": return
|
|
3352
|
-
case "av1": return
|
|
3346
|
+
case "h264": return bo(t);
|
|
3347
|
+
case "av1": return Wo(t);
|
|
3353
3348
|
}
|
|
3354
|
-
},
|
|
3349
|
+
}, Yo = (e, t) => So(e, t), Xo = (e, t) => Ko(e, t), Zo = (e, t, n, r) => {
|
|
3355
3350
|
if (!n || !r) throw Error("HEVC init segment requires width and height");
|
|
3356
|
-
return
|
|
3357
|
-
},
|
|
3351
|
+
return wo(e, t, n, r);
|
|
3352
|
+
}, Qo = (e, t, n) => To(new Uint8Array(e), n, t), $o = (e, t, n) => yo(new Uint8Array(e), n, t, t), es = (e, t) => {
|
|
3358
3353
|
if (!e[0]) throw Error("At least one sample must be provided");
|
|
3359
3354
|
switch (e[0].codec) {
|
|
3360
|
-
case "h264": return
|
|
3361
|
-
case "h265": return
|
|
3362
|
-
case "opus": return
|
|
3363
|
-
case "aac": return
|
|
3364
|
-
case "av1": return
|
|
3355
|
+
case "h264": return xo(e, t);
|
|
3356
|
+
case "h265": return Co(e, t);
|
|
3357
|
+
case "opus": return Eo(e, t);
|
|
3358
|
+
case "aac": return vo(e, t);
|
|
3359
|
+
case "av1": return Go(e, t);
|
|
3365
3360
|
default: throw Error(`Unsupported codec ${e[0].codec}`);
|
|
3366
3361
|
}
|
|
3367
|
-
},
|
|
3362
|
+
}, ts = /* @__PURE__ */ function(e) {
|
|
3368
3363
|
return e[e.NONE = 0] = "NONE", e[e.SYNC = 1] = "SYNC", e[e.INIT = 2] = "INIT", e[e.RENDITIONS = 4] = "RENDITIONS", e[e.TIMED_METADATA = 8] = "TIMED_METADATA", e[e.HAS_COMPOSITION_TIME = 16] = "HAS_COMPOSITION_TIME", e;
|
|
3369
|
-
}({}),
|
|
3370
|
-
let t = new DataView(e, 0), n = t.getUint8(0), r = t.getUint16(1), i = t.getUint8(3), a = t.getUint8(4), o = Ae(new Uint8Array(e), 5, 12), s = t.getUint32(13), c =
|
|
3364
|
+
}({}), ns = (e) => !!(e & ts.SYNC), rs = (e) => !!(e & ts.INIT), is = (e) => !!(e & ts.RENDITIONS), as = (e) => !!(e & ts.TIMED_METADATA), os = (e) => !!(e & ts.HAS_COMPOSITION_TIME), ss = (e) => {
|
|
3365
|
+
let t = new DataView(e, 0), n = t.getUint8(0), r = t.getUint16(1), i = t.getUint8(3), a = t.getUint8(4), o = Ae(new Uint8Array(e), 5, 12), s = t.getUint32(13), c = os(i) ? t.getInt16(17) : void 0;
|
|
3371
3366
|
return {
|
|
3372
3367
|
version: n,
|
|
3373
3368
|
renditionId: a,
|
|
@@ -3377,14 +3372,14 @@ var Do = (e) => {
|
|
|
3377
3372
|
payload: e.slice(r),
|
|
3378
3373
|
compositionTimeOffset: c
|
|
3379
3374
|
};
|
|
3380
|
-
},
|
|
3375
|
+
}, cs = (e, t) => (n) => n.remove(Math.max(0, e), Math.min(Infinity, t)), ls = (e) => {
|
|
3381
3376
|
let { buffered: t } = e;
|
|
3382
3377
|
t.length !== 0 && e.remove(t.start(0), t.end(t.length - 1));
|
|
3383
|
-
},
|
|
3378
|
+
}, us = (e) => (t) => t.appendBuffer(e), ds = (e) => (t) => t.changeType(e), fs = class extends Error {
|
|
3384
3379
|
constructor() {
|
|
3385
3380
|
super("SourceBuffer was disposed before the queued operation ran"), this.name = "SourceBufferDisposedError";
|
|
3386
3381
|
}
|
|
3387
|
-
},
|
|
3382
|
+
}, ps = class {
|
|
3388
3383
|
constructor(t) {
|
|
3389
3384
|
e(this, "commandQueue", []), e(this, "sourceBuffer", void 0), e(this, "errorCallback", void 0), e(this, "isDisposed", !1), e(this, "currentInit", void 0), e(this, "setErrorCallback", (e) => {
|
|
3390
3385
|
this.errorCallback = e;
|
|
@@ -3398,23 +3393,23 @@ var Do = (e) => {
|
|
|
3398
3393
|
}
|
|
3399
3394
|
}), e(this, "enqueue", (e, t, n) => {
|
|
3400
3395
|
if (this.isDisposed) {
|
|
3401
|
-
n(new
|
|
3396
|
+
n(new fs());
|
|
3402
3397
|
return;
|
|
3403
3398
|
}
|
|
3404
3399
|
this.commandQueue.push(new Ct(e, t, n));
|
|
3405
3400
|
}), e(this, "submit", (e) => new Promise((t, n) => {
|
|
3406
3401
|
this.enqueue(e, t, n), this.handleQueue();
|
|
3407
3402
|
})), e(this, "appendBuffer", (e, t) => new Promise((n, r) => {
|
|
3408
|
-
t && this.currentInit !== t && (this.enqueue(
|
|
3403
|
+
t && this.currentInit !== t && (this.enqueue(us(t), o, r), this.currentInit = t), this.enqueue(us(e), n, r), this.handleQueue();
|
|
3409
3404
|
})), e(this, "execute", (e) => this.submit(e)), e(this, "buffered", () => this.sourceBuffer.buffered), e(this, "removeFromMediaSource", (e) => {
|
|
3410
3405
|
this.dispose(), e.removeSourceBuffer(this.sourceBuffer);
|
|
3411
3406
|
}), e(this, "dispose", () => {
|
|
3412
3407
|
this.isDisposed = !0, this.sourceBuffer.removeEventListener("updateend", this.handleQueue), this.sourceBuffer.removeEventListener("error", this.onError);
|
|
3413
3408
|
let e = this.commandQueue;
|
|
3414
|
-
this.commandQueue = [], this.errorCallback = void 0, e.forEach((e) => e.abort(new
|
|
3415
|
-
}), e(this, "changeType", (e) => this.submit(
|
|
3409
|
+
this.commandQueue = [], this.errorCallback = void 0, e.forEach((e) => e.abort(new fs()));
|
|
3410
|
+
}), e(this, "changeType", (e) => this.submit(ds(e))), e(this, "removeBuffer", (e, t) => this.submit(cs(e, t))), e(this, "flush", () => this.submit(ls)), this.sourceBuffer = t, this.sourceBuffer.addEventListener("updateend", this.handleQueue), this.sourceBuffer.addEventListener("error", this.onError);
|
|
3416
3411
|
}
|
|
3417
|
-
},
|
|
3412
|
+
}, ms = class extends fe {
|
|
3418
3413
|
constructor() {
|
|
3419
3414
|
super(), e(this, "MediaSource", Ie()), e(this, "mediaSource", new this.MediaSource()), e(this, "isOpen", () => this.mediaSource.readyState === "open"), e(this, "isClosed", () => this.mediaSource.readyState === "closed"), e(this, "isEnded", () => this.mediaSource.readyState === "ended"), e(this, "createObjectURL", () => URL.createObjectURL(this.mediaSource)), e(this, "attach", (e) => {
|
|
3420
3415
|
let t = e;
|
|
@@ -3430,7 +3425,7 @@ var Do = (e) => {
|
|
|
3430
3425
|
this.mediaSource.endOfStream();
|
|
3431
3426
|
} catch (e) {}
|
|
3432
3427
|
e.srcObject && (e.srcObject = null), e.src !== "" && (URL.revokeObjectURL(e.src), e.removeAttribute("src")), e.load();
|
|
3433
|
-
}), e(this, "addSourceBuffer", (e) => new
|
|
3428
|
+
}), e(this, "addSourceBuffer", (e) => new ps(this.mediaSource.addSourceBuffer(e))), e(this, "removeSourceBuffer", (e) => {
|
|
3434
3429
|
e.removeFromMediaSource(this.mediaSource);
|
|
3435
3430
|
}), e(this, "endOfStream", (e) => {
|
|
3436
3431
|
this.mediaSource.endOfStream(e);
|
|
@@ -3447,17 +3442,17 @@ var Do = (e) => {
|
|
|
3447
3442
|
}), this.mediaSource.addEventListener("sourceopen", this.onSourceOpen), this.mediaSource.addEventListener("sourceclose", this.onSourceClosed), this.mediaSource.addEventListener("sourceended", this.onSourceEnded);
|
|
3448
3443
|
}
|
|
3449
3444
|
};
|
|
3450
|
-
e(
|
|
3445
|
+
e(ms, "isTypeSupported", (e) => {
|
|
3451
3446
|
var t, n;
|
|
3452
3447
|
return (t = (n = Ie()) == null ? void 0 : n.isTypeSupported(e)) == null ? !1 : t;
|
|
3453
3448
|
});
|
|
3454
3449
|
//#endregion
|
|
3455
3450
|
//#region ../../libs/wakelock/src/media.ts
|
|
3456
|
-
var
|
|
3451
|
+
var hs = "data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw", gs = () => "wakeLock" in navigator && window.navigator.userAgent.indexOf("Samsung") === -1, _s = class {
|
|
3457
3452
|
constructor() {
|
|
3458
3453
|
e(this, "enabled", !1), e(this, "wakeLockVideo", void 0), e(this, "_wakeLock", null), e(this, "handleVisibilityChange", () => {
|
|
3459
3454
|
this._wakeLock !== null && document.visibilityState === "visible" && this.enable();
|
|
3460
|
-
}),
|
|
3455
|
+
}), gs() && (this._wakeLock = null, document.addEventListener("visibilitychange", this.handleVisibilityChange), document.addEventListener("fullscreenchange", this.handleVisibilityChange));
|
|
3461
3456
|
}
|
|
3462
3457
|
_addSourceToVideo(e, t, n) {
|
|
3463
3458
|
let r = document.createElement("source");
|
|
@@ -3467,10 +3462,10 @@ var ms = "data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVl
|
|
|
3467
3462
|
return this.enabled;
|
|
3468
3463
|
}
|
|
3469
3464
|
attach(e) {
|
|
3470
|
-
if (!
|
|
3465
|
+
if (!gs()) {
|
|
3471
3466
|
if (!this.wakeLockVideo) {
|
|
3472
3467
|
let e = document.createElement("video");
|
|
3473
|
-
this.wakeLockVideo = e, this.wakeLockVideo.setAttribute("title", "Live Stream"), this.wakeLockVideo.setAttribute("playsinline", ""), this._addSourceToVideo(this.wakeLockVideo, "mp4",
|
|
3468
|
+
this.wakeLockVideo = e, this.wakeLockVideo.setAttribute("title", "Live Stream"), this.wakeLockVideo.setAttribute("playsinline", ""), this._addSourceToVideo(this.wakeLockVideo, "mp4", hs), Object.assign(this.wakeLockVideo.style, {
|
|
3474
3469
|
position: "absolute",
|
|
3475
3470
|
left: "-100%",
|
|
3476
3471
|
top: "-100%"
|
|
@@ -3486,7 +3481,7 @@ var ms = "data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVl
|
|
|
3486
3481
|
enable() {
|
|
3487
3482
|
var e = this;
|
|
3488
3483
|
return t(function* () {
|
|
3489
|
-
if (
|
|
3484
|
+
if (gs()) return navigator.wakeLock.request("screen").then((t) => {
|
|
3490
3485
|
e._wakeLock = t, e.enabled = !0, e._wakeLock.addEventListener("release", () => {});
|
|
3491
3486
|
}).catch(() => {
|
|
3492
3487
|
e.enabled = !1;
|
|
@@ -3498,7 +3493,7 @@ var ms = "data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVl
|
|
|
3498
3493
|
})();
|
|
3499
3494
|
}
|
|
3500
3495
|
disable() {
|
|
3501
|
-
if (
|
|
3496
|
+
if (gs()) this._wakeLock && this._wakeLock.release(), this._wakeLock = null;
|
|
3502
3497
|
else {
|
|
3503
3498
|
var e, t;
|
|
3504
3499
|
(e = this.wakeLockVideo) == null || e.pause(), (t = this.wakeLockVideo) == null || t.remove();
|
|
@@ -3508,94 +3503,69 @@ var ms = "data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVl
|
|
|
3508
3503
|
unload() {
|
|
3509
3504
|
document.removeEventListener("visibilitychange", this.handleVisibilityChange), document.removeEventListener("fullscreenchange", this.handleVisibilityChange), this.disable();
|
|
3510
3505
|
}
|
|
3511
|
-
},
|
|
3506
|
+
}, vs = /\r\n|\r|\n/, ys = /* @__PURE__ */ new WeakMap(), bs = /* @__PURE__ */ new WeakMap(), xs = class {
|
|
3512
3507
|
constructor(e) {
|
|
3513
|
-
C(this,
|
|
3508
|
+
C(this, ys, void 0), C(this, bs, void 0), E(ys, this, e), E(bs, this, 0);
|
|
3514
3509
|
}
|
|
3515
3510
|
skipEmptyLines() {
|
|
3516
3511
|
let e = 0;
|
|
3517
|
-
for (; T(
|
|
3512
|
+
for (; T(ys, this)[T(bs, this)] === "";) {
|
|
3518
3513
|
var t;
|
|
3519
|
-
E(
|
|
3514
|
+
E(bs, this, (t = T(bs, this), t++, t)), e++;
|
|
3520
3515
|
}
|
|
3521
3516
|
return e;
|
|
3522
3517
|
}
|
|
3523
3518
|
readLine() {
|
|
3524
3519
|
var e, t;
|
|
3525
|
-
return T(
|
|
3526
|
-
}
|
|
3527
|
-
peekLine() {
|
|
3528
|
-
return T(vs, this)[T(ys, this)];
|
|
3520
|
+
return T(ys, this)[E(bs, this, (e = T(bs, this), t = e++, e)), t];
|
|
3529
3521
|
}
|
|
3530
3522
|
takeUntilEmptyLine() {
|
|
3531
3523
|
let e = [];
|
|
3532
|
-
for (; T(
|
|
3524
|
+
for (; T(ys, this)[T(bs, this)] !== "";) {
|
|
3533
3525
|
let t = this.readLine();
|
|
3534
3526
|
if (t === void 0) break;
|
|
3535
3527
|
e.push(t);
|
|
3536
3528
|
}
|
|
3537
3529
|
return e;
|
|
3538
3530
|
}
|
|
3539
|
-
skipToNextCue() {
|
|
3540
|
-
for (let e = this.peekLine(); e !== void 0 && e !== "" && !e.includes("-->");) this.readLine(), e = this.peekLine();
|
|
3541
|
-
}
|
|
3542
3531
|
linesLeft() {
|
|
3543
|
-
return T(
|
|
3532
|
+
return T(ys, this).length - T(bs, this);
|
|
3544
3533
|
}
|
|
3545
|
-
},
|
|
3534
|
+
}, Ss = /* @__PURE__ */ new WeakSet(), Cs = class {
|
|
3546
3535
|
constructor() {
|
|
3547
|
-
D(this,
|
|
3536
|
+
D(this, Ss);
|
|
3548
3537
|
}
|
|
3549
3538
|
parse(e) {
|
|
3550
|
-
let t = [], n = new
|
|
3539
|
+
let t = [], n = new xs(e.split(vs)), r = n.readLine();
|
|
3551
3540
|
if (!r || !r.startsWith("WEBVTT")) throw Error("missing 'WEBVTT' signature");
|
|
3552
|
-
for (
|
|
3553
|
-
let e = n.readLine();
|
|
3554
|
-
if (e === "" || e === void 0) break;
|
|
3555
|
-
}
|
|
3541
|
+
for (; n.readLine() !== "";);
|
|
3556
3542
|
for (; n.linesLeft() > 0;) {
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
e && t.push(e);
|
|
3560
|
-
} catch (e) {
|
|
3561
|
-
n.skipToNextCue();
|
|
3562
|
-
}
|
|
3563
|
-
n.skipEmptyLines();
|
|
3543
|
+
let e = w(Ss, this, ws).call(this, n);
|
|
3544
|
+
e && t.push(e), n.skipEmptyLines();
|
|
3564
3545
|
}
|
|
3565
3546
|
return t;
|
|
3566
3547
|
}
|
|
3567
3548
|
};
|
|
3568
|
-
function
|
|
3569
|
-
var t;
|
|
3549
|
+
function ws(e) {
|
|
3570
3550
|
e.skipEmptyLines();
|
|
3571
|
-
let
|
|
3572
|
-
if (n
|
|
3573
|
-
if (
|
|
3574
|
-
e.takeUntilEmptyLine();
|
|
3575
|
-
return;
|
|
3576
|
-
}
|
|
3577
|
-
if (!n.includes("-->")) {
|
|
3578
|
-
let t = e.peekLine();
|
|
3579
|
-
if (t === void 0 || t === "") throw Error("expected cue line");
|
|
3580
|
-
r = n, e.readLine(), n = t;
|
|
3581
|
-
}
|
|
3582
|
-
if (n === void 0) throw Error("expected cue line");
|
|
3551
|
+
let t = new xs(e.takeUntilEmptyLine()), n = t.readLine(), r;
|
|
3552
|
+
if (n != null && n.startsWith("NOTE")) return;
|
|
3553
|
+
if (n != null && n.includes("-->") || (r = n, n = t.readLine()), n === void 0) throw Error("expected cue line");
|
|
3583
3554
|
let [i, a] = n.split("-->").map((e) => e.trim());
|
|
3584
3555
|
if (!i || !a) throw Error(`a cue needs both start and end time start: ${i} end: ${a}`);
|
|
3585
3556
|
let [o, s] = a.split(" ", 1).map((e) => e.trim());
|
|
3586
3557
|
if (!o) throw Error(`missing end time: ${o}`);
|
|
3587
|
-
let c =
|
|
3588
|
-
|
|
3589
|
-
let l =
|
|
3590
|
-
|
|
3591
|
-
if (l !== "") return {
|
|
3558
|
+
let c = t.readLine();
|
|
3559
|
+
if (!c) throw Error("missing text");
|
|
3560
|
+
let l = w(Ss, this, Ts).call(this, i), u = w(Ss, this, Ts).call(this, o);
|
|
3561
|
+
return {
|
|
3592
3562
|
id: r,
|
|
3593
|
-
startTime:
|
|
3594
|
-
endTime:
|
|
3595
|
-
text:
|
|
3563
|
+
startTime: l,
|
|
3564
|
+
endTime: u,
|
|
3565
|
+
text: c
|
|
3596
3566
|
};
|
|
3597
3567
|
}
|
|
3598
|
-
function
|
|
3568
|
+
function Ts(e) {
|
|
3599
3569
|
let t = e.split(":");
|
|
3600
3570
|
if (t.length === 2) {
|
|
3601
3571
|
let [e = 0, n = 0] = t.map((e) => parseFloat(e));
|
|
@@ -3606,10 +3576,10 @@ function ws(e) {
|
|
|
3606
3576
|
}
|
|
3607
3577
|
//#endregion
|
|
3608
3578
|
//#region ../../libs/web-sdk/src/debugMode.ts
|
|
3609
|
-
var
|
|
3579
|
+
var Es = (e) => {
|
|
3610
3580
|
let t = window;
|
|
3611
3581
|
t.vindralInstances = t.vindralInstances || {}, t.vindralInstances[e.getStatistics().clientId.substring(0, 8)] = e;
|
|
3612
|
-
},
|
|
3582
|
+
}, Ds = class n extends fe {
|
|
3613
3583
|
constructor({ type: r, autoplay: i, muted: a, volume: s, logger: c, poster: l }) {
|
|
3614
3584
|
var u;
|
|
3615
3585
|
super(), u = this, e(this, "element", void 0), e(this, "logger", void 0), e(this, "seekTimes", new S(10)), e(this, "seekStartTime", void 0), e(this, "_totalSeekTime", 0), e(this, "lastPlayableAt", void 0), e(this, "_userProvidedMuted", void 0), e(this, "timers", new P()), e(this, "_userHasProvidedInput", !1), e(this, "_isPaused", !0), e(this, "isActivated", !1), e(this, "dummy", void 0), e(this, "addEventListeners", () => {
|
|
@@ -3739,10 +3709,10 @@ var Ts = (e) => {
|
|
|
3739
3709
|
return this._isPaused;
|
|
3740
3710
|
}
|
|
3741
3711
|
};
|
|
3742
|
-
e(
|
|
3712
|
+
e(Ds, "SEEK_SETTLE_BUDGET_MS", 1e3);
|
|
3743
3713
|
//#endregion
|
|
3744
3714
|
//#region ../../libs/web-sdk/src/mediaCapabilities.ts
|
|
3745
|
-
var
|
|
3715
|
+
var Os = (e) => {
|
|
3746
3716
|
if (!navigator.mediaCapabilities) return Promise.resolve({
|
|
3747
3717
|
smooth: !0,
|
|
3748
3718
|
supported: !0,
|
|
@@ -3769,7 +3739,7 @@ var Ds = (e) => {
|
|
|
3769
3739
|
framerate: e.frameRate[0] / e.frameRate[1]
|
|
3770
3740
|
}
|
|
3771
3741
|
}, navigator.mediaCapabilities.decodingInfo(t);
|
|
3772
|
-
},
|
|
3742
|
+
}, ks, As = .15, js = .2, Ms = .4, Ns = .5, Ps = .6, Fs = 15, Is = {
|
|
3773
3743
|
cooldownTime: 3e3,
|
|
3774
3744
|
maxBufferingEvents: { last10Seconds: 0 },
|
|
3775
3745
|
maxBufferingRatio: { last10Seconds: 0 },
|
|
@@ -3780,7 +3750,7 @@ var Ds = (e) => {
|
|
|
3780
3750
|
ratio: .1
|
|
3781
3751
|
},
|
|
3782
3752
|
maxCooldownRatio: 2
|
|
3783
|
-
},
|
|
3753
|
+
}, Ls = (e) => (t) => t > e, Rs = class {
|
|
3784
3754
|
constructor(t, n, r, i) {
|
|
3785
3755
|
e(this, "qualityOfServiceSource", void 0), e(this, "config", void 0), e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "isSuspended", !1), e(this, "lastAdaptTime", performance.now()), e(this, "isEnabled", !0), e(this, "load", () => {
|
|
3786
3756
|
this.emitter.on("buffer state", this.onBufferState), this.emitter.on("adapted level", this.onAdaptedLevel);
|
|
@@ -3796,7 +3766,7 @@ var Ds = (e) => {
|
|
|
3796
3766
|
let t = this.qualityOfServiceSource.getLevelStats(e), { upgradesFromLevel: n, downgradesFromLevel: r } = t == null ? {
|
|
3797
3767
|
upgradesFromLevel: [],
|
|
3798
3768
|
downgradesFromLevel: []
|
|
3799
|
-
} : t, i = performance.now() - this.config.maxDowngradeLookbackMs, a = r.filter(
|
|
3769
|
+
} : t, i = performance.now() - this.config.maxDowngradeLookbackMs, a = r.filter(Ls(i)).length, o = n.filter(Ls(i)).length;
|
|
3800
3770
|
if (a - o > this.config.maxRecentDowngradesCount) return this.logger.debug("Recent downgrades count is over maximum", {
|
|
3801
3771
|
downgrades: a - o,
|
|
3802
3772
|
maxRecentDowngradesCount: this.config.maxRecentDowngradesCount
|
|
@@ -3810,7 +3780,7 @@ var Ds = (e) => {
|
|
|
3810
3780
|
recentDowngrades: a,
|
|
3811
3781
|
timeSpentPlayingInAtLeastLevelRatio: s
|
|
3812
3782
|
}), !1;
|
|
3813
|
-
let l = Math.max(0, r.length - n.length - c), u = performance.now() - this.config.maxDowngradeLookbackMs * l, d = r.filter(
|
|
3783
|
+
let l = Math.max(0, r.length - n.length - c), u = performance.now() - this.config.maxDowngradeLookbackMs * l, d = r.filter(Ls(u)).length;
|
|
3814
3784
|
return d && l > this.config.maxCooldownRatio ? (this.logger.debug("Too many downgrades compared to time spent playing", {
|
|
3815
3785
|
downgradesWithinCooldownTime: d,
|
|
3816
3786
|
cooldownRatio: l
|
|
@@ -3819,7 +3789,7 @@ var Ds = (e) => {
|
|
|
3819
3789
|
if (!this.isEnabled || this.isSuspended || this.lastAdaptTime + this.config.cooldownTime > performance.now()) return;
|
|
3820
3790
|
let { bufferFullness: t, general: n } = this.qualityOfServiceSource.getMetrics(), r = this.qualityOfServiceSource.getBufferFullnessRegression();
|
|
3821
3791
|
if (!r) return;
|
|
3822
|
-
let i = 10 * 1e3, a = 30 * 1e3, { slope: o } = r, s = r.predict(
|
|
3792
|
+
let i = 10 * 1e3, a = 30 * 1e3, { slope: o } = r, s = r.predict(Fs), c = o < 0, l = r.predict(Fs) < Ms && r.slope < 0, u = r.predict(Fs) > Ps, d = this.qualityOfServiceSource.timeSpentBufferingLast(a), f = this.qualityOfServiceSource.timeSpentActiveLast(a), p = this.qualityOfServiceSource.bufferingEventsLast(a), m = f > 0 ? d / f : 0, h = this.qualityOfServiceSource.getTargetBufferTime();
|
|
3823
3793
|
if (t < .15 && m > .8) {
|
|
3824
3794
|
this.adaptLevel("reconnect");
|
|
3825
3795
|
return;
|
|
@@ -3828,7 +3798,7 @@ var Ds = (e) => {
|
|
|
3828
3798
|
this.adaptLevel("downgrade");
|
|
3829
3799
|
return;
|
|
3830
3800
|
}
|
|
3831
|
-
if (t >
|
|
3801
|
+
if (t > Ns && u && !this.tooMuchTimeBuffering(i) && !this.tooManyBufferingEvents(i)) {
|
|
3832
3802
|
this.adaptLevel("upgrade");
|
|
3833
3803
|
return;
|
|
3834
3804
|
}
|
|
@@ -3836,10 +3806,10 @@ var Ds = (e) => {
|
|
|
3836
3806
|
e.playbackState === "buffering" && (p > 5 || m > .3) && this.adaptLevel("downgrade");
|
|
3837
3807
|
return;
|
|
3838
3808
|
}
|
|
3839
|
-
(l || t <
|
|
3809
|
+
(l || t < As) && c && t < Ms && s < js && this.adaptLevel(e.playbackState === "buffering" ? "double downgrade" : "downgrade");
|
|
3840
3810
|
}), e(this, "onAdaptedLevel", () => {
|
|
3841
3811
|
this.reset();
|
|
3842
|
-
}), e(this, "adaptLevel", (e) => this.emitter.emit("adapt level", e)), this.qualityOfServiceSource = r, this.config = O(O({},
|
|
3812
|
+
}), e(this, "adaptLevel", (e) => this.emitter.emit("adapt level", e)), this.qualityOfServiceSource = r, this.config = O(O({}, Is), i), this.emitter = t, this.logger = n;
|
|
3843
3813
|
}
|
|
3844
3814
|
tooMuchTimeBuffering(e) {
|
|
3845
3815
|
let t = this.qualityOfServiceSource.timeSpentActiveLast(e);
|
|
@@ -3849,16 +3819,16 @@ var Ds = (e) => {
|
|
|
3849
3819
|
return this.qualityOfServiceSource.timeSpentBufferingLast(e) > this.config.maxBufferingEvents.last10Seconds;
|
|
3850
3820
|
}
|
|
3851
3821
|
};
|
|
3852
|
-
|
|
3822
|
+
ks = Rs, e(Rs, "create", (e, t, n, r = {}) => new ks(e, t, n, r));
|
|
3853
3823
|
//#endregion
|
|
3854
3824
|
//#region ../../libs/web-sdk/src/modules/BufferTimeModule.ts
|
|
3855
|
-
var
|
|
3825
|
+
var zs, Bs = {
|
|
3856
3826
|
minBufferTime: 1500,
|
|
3857
3827
|
maxBufferTime: 1500,
|
|
3858
3828
|
cooldownTime: 3e4,
|
|
3859
3829
|
maxBufferingEvents: { last30Seconds: 3 },
|
|
3860
3830
|
maxBufferingRatio: { last30Seconds: .15 }
|
|
3861
|
-
},
|
|
3831
|
+
}, Vs = class t {
|
|
3862
3832
|
constructor(n, r, i, a, o) {
|
|
3863
3833
|
e(this, "qualityOfServiceSource", void 0), e(this, "targetBufferTimeTarget", void 0), e(this, "config", void 0), e(this, "emitter", void 0), e(this, "logger", void 0), e(this, "isSuspended", !1), e(this, "lastIncreaseTime", performance.now()), e(this, "bufferTimeAdjustmentCount", 0), e(this, "load", () => {
|
|
3864
3834
|
this.emitter.on("buffer state", this.onBufferState);
|
|
@@ -3875,18 +3845,18 @@ var Rs, zs = {
|
|
|
3875
3845
|
if (this.isSuspended || this.lastIncreaseTime + i > performance.now() || this.targetBufferTimeTarget.targetBufferTime >= r) return;
|
|
3876
3846
|
let a = this.qualityOfServiceSource.timeSpentBufferingLast(30 * 1e3), o = this.qualityOfServiceSource.bufferingEventsLast(30 * 1e3), s = a / this.qualityOfServiceSource.timeSpentActiveLast(30 * 1e3), c = Math.ceil(Math.max((r - n) / (t.BUFFER_TIME_MAX_STEPS - 1), t.BUFFER_TIME_STEP_SIZE));
|
|
3877
3847
|
(s > this.config.maxBufferingRatio.last30Seconds || o > this.config.maxBufferingEvents.last30Seconds) && (this.targetBufferTimeTarget.targetBufferTime = Math.min(r, this.targetBufferTimeTarget.targetBufferTime + c), this.bufferTimeAdjustmentCount++, this.reset());
|
|
3878
|
-
}), this.qualityOfServiceSource = i, this.targetBufferTimeTarget = a, this.config = O(O({},
|
|
3848
|
+
}), this.qualityOfServiceSource = i, this.targetBufferTimeTarget = a, this.config = O(O({}, Bs), o), this.emitter = n, this.logger = r;
|
|
3879
3849
|
}
|
|
3880
3850
|
updateConfig(e) {
|
|
3881
3851
|
this.config = O(O({}, this.config), e);
|
|
3882
3852
|
}
|
|
3883
3853
|
};
|
|
3884
|
-
|
|
3854
|
+
zs = Vs, e(Vs, "BUFFER_TIME_STEP_SIZE", 500), e(Vs, "BUFFER_TIME_MAX_STEPS", 3), e(Vs, "create", (e, t, n, r, i = {}) => new zs(e, t, n, r, i));
|
|
3885
3855
|
//#endregion
|
|
3886
3856
|
//#region ../../libs/moq/src/protocol/wire-format/DataStreamType.ts
|
|
3887
|
-
var
|
|
3857
|
+
var Hs = /* @__PURE__ */ function(e) {
|
|
3888
3858
|
return e[e.StreamHeaderGroup = 4] = "StreamHeaderGroup", e[e.FetchHeader = 5] = "FetchHeader", e[e.StreamHeaderTrack = 60] = "StreamHeaderTrack", e;
|
|
3889
|
-
}({}),
|
|
3859
|
+
}({}), Us, Ws, Gs, Ks, qs, Js, Ys, Xs, Zs, W = {
|
|
3890
3860
|
Normal: 0,
|
|
3891
3861
|
ObjectDoesNotExist: 1,
|
|
3892
3862
|
GroupDoesNotExist: 2,
|
|
@@ -3895,16 +3865,16 @@ var Vs = /* @__PURE__ */ function(e) {
|
|
|
3895
3865
|
};
|
|
3896
3866
|
function Qs(e) {
|
|
3897
3867
|
switch (e) {
|
|
3898
|
-
case
|
|
3899
|
-
case
|
|
3900
|
-
case
|
|
3901
|
-
case
|
|
3902
|
-
case
|
|
3868
|
+
case W.Normal:
|
|
3869
|
+
case W.ObjectDoesNotExist:
|
|
3870
|
+
case W.GroupDoesNotExist:
|
|
3871
|
+
case W.EndOfGroup:
|
|
3872
|
+
case W.EndOfTrackAndGroup: return;
|
|
3903
3873
|
}
|
|
3904
3874
|
throw Error(`Unknown object status ${e}`);
|
|
3905
3875
|
}
|
|
3906
3876
|
var $s = /* @__PURE__ */ new WeakMap(), ec = /* @__PURE__ */ new WeakMap(), tc = /* @__PURE__ */ new WeakMap(), nc = /* @__PURE__ */ new WeakMap(), rc = /* @__PURE__ */ new WeakMap(), ic = /* @__PURE__ */ new WeakMap(), ac = /* @__PURE__ */ new WeakMap(), oc = /* @__PURE__ */ new WeakMap();
|
|
3907
|
-
|
|
3877
|
+
Us = Symbol.asyncIterator, Ws = Bt(), Gs = Symbol.asyncDispose;
|
|
3908
3878
|
var sc = class {
|
|
3909
3879
|
endStatus() {
|
|
3910
3880
|
return T(ic, this).promise;
|
|
@@ -3927,7 +3897,7 @@ var sc = class {
|
|
|
3927
3897
|
value: void 0
|
|
3928
3898
|
};
|
|
3929
3899
|
let n = T(ac, e) === 0 ? T(ec, e) : yield T($s, e).readBigVarInt(), r = yield T($s, e).readBigVarInt(), i = yield T($s, e).readVarInt(), a = 0, o = new Uint8Array();
|
|
3930
|
-
return i > 0 ? o = yield T($s, e).read(i) : a = yield T($s, e).readVarInt(), Qs(a), (a ===
|
|
3900
|
+
return i > 0 ? o = yield T($s, e).read(i) : a = yield T($s, e).readVarInt(), Qs(a), (a === W.EndOfTrackAndGroup || a === W.EndOfGroup) && T(ic, e).resolve(a), E(ac, e, (t = T(ac, e), t++, t)), {
|
|
3931
3901
|
done: !1,
|
|
3932
3902
|
value: {
|
|
3933
3903
|
subscribeId: T(tc, e),
|
|
@@ -3953,17 +3923,17 @@ var sc = class {
|
|
|
3953
3923
|
};
|
|
3954
3924
|
})();
|
|
3955
3925
|
}
|
|
3956
|
-
[
|
|
3926
|
+
[Us]() {
|
|
3957
3927
|
return this;
|
|
3958
3928
|
}
|
|
3959
|
-
[
|
|
3929
|
+
[Ws]() {
|
|
3960
3930
|
return Promise.resolve();
|
|
3961
3931
|
}
|
|
3962
|
-
[
|
|
3932
|
+
[Gs]() {
|
|
3963
3933
|
return Promise.resolve();
|
|
3964
3934
|
}
|
|
3965
3935
|
}, cc = /* @__PURE__ */ new WeakMap(), lc = /* @__PURE__ */ new WeakMap(), uc = /* @__PURE__ */ new WeakMap(), dc = /* @__PURE__ */ new WeakMap(), fc = /* @__PURE__ */ new WeakMap(), pc = /* @__PURE__ */ new WeakSet();
|
|
3966
|
-
|
|
3936
|
+
Ks = Symbol.asyncIterator, qs = Bt(), Js = Symbol.asyncDispose;
|
|
3967
3937
|
var mc = class {
|
|
3968
3938
|
constructor(e, t, n, r, i) {
|
|
3969
3939
|
D(this, pc), C(this, cc, void 0), C(this, lc, void 0), C(this, uc, void 0), C(this, dc, void 0), C(this, fc, void 0), E(cc, this, e), E(lc, this, t), E(uc, this, n), E(dc, this, r), E(fc, this, i);
|
|
@@ -3986,13 +3956,13 @@ var mc = class {
|
|
|
3986
3956
|
};
|
|
3987
3957
|
})();
|
|
3988
3958
|
}
|
|
3989
|
-
[
|
|
3959
|
+
[Ks]() {
|
|
3990
3960
|
return this;
|
|
3991
3961
|
}
|
|
3992
|
-
[
|
|
3962
|
+
[qs]() {
|
|
3993
3963
|
return w(pc, this, gc).call(this);
|
|
3994
3964
|
}
|
|
3995
|
-
[
|
|
3965
|
+
[Js]() {
|
|
3996
3966
|
return w(pc, this, gc).call(this);
|
|
3997
3967
|
}
|
|
3998
3968
|
};
|
|
@@ -4001,7 +3971,7 @@ function hc() {
|
|
|
4001
3971
|
return Zt(function* () {
|
|
4002
3972
|
for (; !(yield N(T(cc, e).isDone()));) {
|
|
4003
3973
|
let t = yield N(T(cc, e).readBigVarInt()), n = new sc(T(cc, e), t, T(lc, e), T(uc, e), T(dc, e), T(fc, e));
|
|
4004
|
-
if (yield n, (yield N(Promise.race([n.endStatus(), T(cc, e).closed()]))) ===
|
|
3974
|
+
if (yield n, (yield N(Promise.race([n.endStatus(), T(cc, e).closed()]))) === W.EndOfTrackAndGroup) return;
|
|
4005
3975
|
}
|
|
4006
3976
|
})();
|
|
4007
3977
|
}
|
|
@@ -4009,7 +3979,7 @@ function gc() {
|
|
|
4009
3979
|
return T(cc, this).close().catch(() => {});
|
|
4010
3980
|
}
|
|
4011
3981
|
var _c = /* @__PURE__ */ new WeakMap(), vc = /* @__PURE__ */ new WeakMap(), yc = /* @__PURE__ */ new WeakMap(), bc = /* @__PURE__ */ new WeakMap(), xc = /* @__PURE__ */ new WeakMap(), Sc = /* @__PURE__ */ new WeakMap(), Cc = /* @__PURE__ */ new WeakMap(), wc = /* @__PURE__ */ new WeakMap(), Tc = /* @__PURE__ */ new WeakMap(), Ec = /* @__PURE__ */ new WeakSet();
|
|
4012
|
-
|
|
3982
|
+
Ys = Symbol.asyncIterator, Xs = Bt(), Zs = Symbol.asyncDispose;
|
|
4013
3983
|
var Dc = class {
|
|
4014
3984
|
constructor(e, t, n, r, i, a, o) {
|
|
4015
3985
|
D(this, Ec), C(this, _c, void 0), C(this, vc, void 0), C(this, yc, void 0), C(this, bc, void 0), C(this, xc, void 0), C(this, Sc, void 0), C(this, Cc, !1), C(this, wc, void 0), C(this, Tc, M.get().createContext("GroupReader")), E(_c, this, e), E(vc, this, t), E(yc, this, n), E(bc, this, r), E(xc, this, i), E(Sc, this, a), E(wc, this, o);
|
|
@@ -4032,7 +4002,7 @@ var Dc = class {
|
|
|
4032
4002
|
value: void 0
|
|
4033
4003
|
};
|
|
4034
4004
|
let t = yield T(_c, e).readBigVarInt(), n = yield T(_c, e).readVarInt(), r = 0, i = new Uint8Array();
|
|
4035
|
-
return n > 0 ? i = yield T(_c, e).read(n) : r = yield T(_c, e).readVarInt(), Qs(r), r ===
|
|
4005
|
+
return n > 0 ? i = yield T(_c, e).read(n) : r = yield T(_c, e).readVarInt(), Qs(r), r === W.EndOfGroup && E(Cc, e, !0), {
|
|
4036
4006
|
done: !1,
|
|
4037
4007
|
value: {
|
|
4038
4008
|
subscribeId: T(vc, e),
|
|
@@ -4066,13 +4036,13 @@ var Dc = class {
|
|
|
4066
4036
|
groups() {
|
|
4067
4037
|
return w(Ec, this, Oc).call(this);
|
|
4068
4038
|
}
|
|
4069
|
-
[
|
|
4039
|
+
[Ys]() {
|
|
4070
4040
|
return this;
|
|
4071
4041
|
}
|
|
4072
|
-
[
|
|
4042
|
+
[Xs]() {
|
|
4073
4043
|
return w(Ec, this, kc).call(this);
|
|
4074
4044
|
}
|
|
4075
|
-
[
|
|
4045
|
+
[Zs]() {
|
|
4076
4046
|
return w(Ec, this, kc).call(this);
|
|
4077
4047
|
}
|
|
4078
4048
|
};
|
|
@@ -4092,8 +4062,8 @@ function jc() {
|
|
|
4092
4062
|
return jc = t(function* (e, t) {
|
|
4093
4063
|
let n = yield e.readVarInt();
|
|
4094
4064
|
switch (n) {
|
|
4095
|
-
case
|
|
4096
|
-
case
|
|
4065
|
+
case Hs.StreamHeaderGroup: return new Dc(e, yield e.readBigVarInt(), yield e.readBigVarInt(), yield e.readBigVarInt(), yield e.readBigVarInt(), yield e.readUnsigned8(), t);
|
|
4066
|
+
case Hs.StreamHeaderTrack: return new mc(e, yield e.readBigVarInt(), yield e.readBigVarInt(), yield e.readUnsigned8(), t);
|
|
4097
4067
|
default: throw Error(`Unexpected message type ${n}`);
|
|
4098
4068
|
}
|
|
4099
4069
|
}), jc.apply(this, arguments);
|
|
@@ -5217,7 +5187,7 @@ var Td = /* @__PURE__ */ new WeakMap(), Ed = /* @__PURE__ */ new WeakMap(), Dd =
|
|
|
5217
5187
|
write(e) {
|
|
5218
5188
|
var n = this;
|
|
5219
5189
|
return t(function* () {
|
|
5220
|
-
T(Ed, n) || (yield T(Td, n).writeVarInt(
|
|
5190
|
+
T(Ed, n) || (yield T(Td, n).writeVarInt(Hs.StreamHeaderGroup), yield T(Td, n).writeBigVarInt(e.subscribeId), yield T(Td, n).writeBigVarInt(e.trackAlias), yield T(Td, n).writeBigVarInt(e.groupId), yield T(Td, n).writeBigVarInt(e.subGroupId), yield T(Td, n).writeUnsigned8(e.subscriberPriority), E(Ed, n, !0)), yield T(Td, n).writeBigVarInt(e.objectId), yield T(Td, n).writeVarInt(e.payload.length), e.payload.length > 0 ? yield T(Td, n).write(e.payload) : yield T(Td, n).writeVarInt(e.objectStatus), yield T(Td, n).flush();
|
|
5221
5191
|
})();
|
|
5222
5192
|
}
|
|
5223
5193
|
close() {
|
|
@@ -6678,7 +6648,7 @@ function pm() {
|
|
|
6678
6648
|
for (var a = G(t), o; n = !(o = yield a.next()).done; n = !1) {
|
|
6679
6649
|
let t = o.value;
|
|
6680
6650
|
{
|
|
6681
|
-
if (t.objectStatus !==
|
|
6651
|
+
if (t.objectStatus !== W.Normal) continue;
|
|
6682
6652
|
let n = om(t);
|
|
6683
6653
|
T(sm, e).update(n);
|
|
6684
6654
|
}
|
|
@@ -6754,7 +6724,7 @@ var Rm = class {
|
|
|
6754
6724
|
for (var a = G(T(Pm, e)), o; n = !(o = yield N(a.next())).done; n = !1) {
|
|
6755
6725
|
let t = o.value;
|
|
6756
6726
|
{
|
|
6757
|
-
if (t.objectStatus ===
|
|
6727
|
+
if (t.objectStatus === W.EndOfTrackAndGroup && (yield N(e.track.endOfTrack(t.groupId))), t.objectStatus !== W.Normal) continue;
|
|
6758
6728
|
let n = T(Fm, e).createFragment(t.payload), r = n.timescale(), i = n.baseMediaDecodeTime() / r * 1e3, a = i + n.duration() / r * 1e3, o = T(Nm, e) / 1e3 * r;
|
|
6759
6729
|
n.updateBaseMediaDecodeTime(n.baseMediaDecodeTime() - o);
|
|
6760
6730
|
let l = e.track.timestampRange();
|
|
@@ -6815,11 +6785,11 @@ var Wm = class n {
|
|
|
6815
6785
|
let t = new jp().name(r.initTrack).build(), [c, l] = yield Promise.all([Gm.call(n, e, t), rm.subscribe(e, s, {
|
|
6816
6786
|
params: o,
|
|
6817
6787
|
largestGroupId: a ? a - A(1) : void 0
|
|
6818
|
-
})]), u = new
|
|
6788
|
+
})]), u = new ya(c);
|
|
6819
6789
|
return new n(r, e.namespace(), l, u, i);
|
|
6820
6790
|
}
|
|
6821
6791
|
oe(r.initData, "no init data found on track");
|
|
6822
|
-
let c = Fe(r.initData), l = new
|
|
6792
|
+
let c = Fe(r.initData), l = new ya(new Uint8Array(c)), u = yield rm.subscribe(e, s, {
|
|
6823
6793
|
params: o,
|
|
6824
6794
|
largestGroupId: a ? a - A(1) : void 0
|
|
6825
6795
|
});
|
|
@@ -6948,7 +6918,7 @@ function nh(e) {
|
|
|
6948
6918
|
for (var f = G(e), p; l = !(p = yield f.next()).done; l = !1) {
|
|
6949
6919
|
let e = p.value;
|
|
6950
6920
|
{
|
|
6951
|
-
if (e.objectStatus !==
|
|
6921
|
+
if (e.objectStatus !== W.Normal) continue;
|
|
6952
6922
|
let r = ih(e.payload);
|
|
6953
6923
|
T(Ym, n).update((e) => {
|
|
6954
6924
|
var t, n;
|
|
@@ -7022,7 +6992,7 @@ var lh = /* @__PURE__ */ new WeakMap(), uh = /* @__PURE__ */ new WeakMap(), dh =
|
|
|
7022
6992
|
ah = Symbol.asyncIterator, oh = Bt(), sh = Symbol.asyncDispose;
|
|
7023
6993
|
var ph = class n {
|
|
7024
6994
|
constructor(t, n, r, i, a) {
|
|
7025
|
-
C(this, lh, new
|
|
6995
|
+
C(this, lh, new Cs()), C(this, uh, void 0), C(this, dh, void 0), C(this, fh, 0), e(this, "trackObject", void 0), e(this, "namespace", void 0), E(dh, this, t), E(uh, this, n), this.trackObject = r, this.namespace = i, E(fh, this, a);
|
|
7026
6996
|
}
|
|
7027
6997
|
static subscribe(e, r, i) {
|
|
7028
6998
|
return t(function* () {
|
|
@@ -7046,19 +7016,13 @@ var ph = class n {
|
|
|
7046
7016
|
for (;;) {
|
|
7047
7017
|
let t = yield T(uh, e).next();
|
|
7048
7018
|
if (t.done) return t;
|
|
7049
|
-
if (t.value.objectStatus !==
|
|
7050
|
-
let n = new TextDecoder().decode(t.value.payload), r;
|
|
7051
|
-
try {
|
|
7052
|
-
r = T(lh, e).parse(n);
|
|
7053
|
-
} catch (e) {
|
|
7054
|
-
continue;
|
|
7055
|
-
}
|
|
7056
|
-
let i = r.map((t) => (t.startTime -= T(fh, e) / 1e3, t.endTime -= T(fh, e) / 1e3, t));
|
|
7019
|
+
if (t.value.objectStatus !== W.Normal) continue;
|
|
7020
|
+
let n = new TextDecoder().decode(t.value.payload), r = T(lh, e).parse(n).map((t) => (t.startTime -= T(fh, e) / 1e3, t.endTime -= T(fh, e) / 1e3, t));
|
|
7057
7021
|
return {
|
|
7058
7022
|
done: !1,
|
|
7059
7023
|
value: {
|
|
7060
7024
|
language: e.trackObject.language,
|
|
7061
|
-
cues:
|
|
7025
|
+
cues: r
|
|
7062
7026
|
}
|
|
7063
7027
|
};
|
|
7064
7028
|
}
|
|
@@ -7313,7 +7277,7 @@ function Uh(e) {
|
|
|
7313
7277
|
for (var a = G(e), o; t = !(o = yield a.next()).done; t = !1) {
|
|
7314
7278
|
let e = o.value;
|
|
7315
7279
|
{
|
|
7316
|
-
if (e.objectStatus !==
|
|
7280
|
+
if (e.objectStatus !== W.Normal) continue;
|
|
7317
7281
|
let t = Rh(e.payload);
|
|
7318
7282
|
n.value.update(t);
|
|
7319
7283
|
}
|
|
@@ -8301,11 +8265,7 @@ var $g = (e) => {
|
|
|
8301
8265
|
return T(o_, this).items().length > 0 ? wt(T(o_, this).items()) : 0;
|
|
8302
8266
|
}
|
|
8303
8267
|
get estimatedBandwidth() {
|
|
8304
|
-
|
|
8305
|
-
let e = this.connectionImpl.estimatedBandwidth;
|
|
8306
|
-
if (e && Number.isFinite(e)) return e;
|
|
8307
|
-
}
|
|
8308
|
-
return Zg(this.rtt);
|
|
8268
|
+
return this.connectionImpl && "estimatedBandwidth" in this.connectionImpl && this.connectionImpl.estimatedBandwidth ? this.connectionImpl.estimatedBandwidth : Zg(this.rtt);
|
|
8309
8269
|
}
|
|
8310
8270
|
get firstConnectStartTime() {
|
|
8311
8271
|
return T(p_, this);
|
|
@@ -8671,7 +8631,7 @@ var F_ = (e, t) => `${e}\u0000${t == null ? "" : t}`, I_ = (e, t, n, r) => e ===
|
|
|
8671
8631
|
break;
|
|
8672
8632
|
}
|
|
8673
8633
|
case "video": {
|
|
8674
|
-
let { VideoDecoderWorkerContext: n } = yield import("./
|
|
8634
|
+
let { VideoDecoderWorkerContext: n } = yield import("./C5AsBfiL.js"), r = yield n.create(i.createContext("VideoDecoderWorker"), a, c, l, u, d, () => s.currentTime);
|
|
8675
8635
|
p = r.isWebCodecs, h = r.usingOffscreenCanvas, t.set(e.type, {
|
|
8676
8636
|
buffer: [],
|
|
8677
8637
|
decoderContext: r,
|
|
@@ -9053,7 +9013,7 @@ ov = uv, e(uv, "create", (e, t, n) => new ov(e, t, n));
|
|
|
9053
9013
|
//#region ../../libs/web-sdk/src/players/VideoPlayer.ts
|
|
9054
9014
|
var dv, fv = class {
|
|
9055
9015
|
constructor(t, n, r, i, a, o) {
|
|
9056
|
-
e(this, "staleFrameThresholdMs", 400), e(this, "pool", void 0), e(this, "logger", void 0), e(this, "videoRenderer", new
|
|
9016
|
+
e(this, "staleFrameThresholdMs", 400), e(this, "pool", void 0), e(this, "logger", void 0), e(this, "videoRenderer", new cr()), e(this, "videoFrameCanvas2DRenderer", null), e(this, "renderQueue", []), e(this, "clockSource", void 0), e(this, "isFirstFrame", !0), e(this, "usingWebCodecs", !1), e(this, "onCanvasChangeCallback", void 0), e(this, "onRendererErrorCallback", void 0), e(this, "animationFrameRequest", void 0), e(this, "firstFrameAnimationFrameRequest", void 0), e(this, "pendingFirstFrameSample", void 0), e(this, "renderedFrameCount", 0), e(this, "rendererDroppedFrameCount", 0), e(this, "renderTargetSize", void 0), e(this, "load", () => {
|
|
9057
9017
|
this.videoRenderer.load(), this.subscribeToContextLost(this.videoRenderer);
|
|
9058
9018
|
}), e(this, "unload", () => (this.stopRender(), this.clearRenderQueue(), this.unsubscribeFromContextLost(this.videoRenderer), this.videoRenderer.unload(), this.videoFrameCanvas2DRenderer && (this.unsubscribeFromContextLost(this.videoFrameCanvas2DRenderer), this.videoFrameCanvas2DRenderer.unload()), Promise.resolve())), e(this, "suspend", () => {
|
|
9059
9019
|
this.clearRenderQueue(), this.stopRender();
|
|
@@ -9088,7 +9048,7 @@ var dv, fv = class {
|
|
|
9088
9048
|
let n = this.videoFrameCanvas2DRenderer;
|
|
9089
9049
|
if (!this.usingWebCodecs) {
|
|
9090
9050
|
var t;
|
|
9091
|
-
this.logger.info("Switching to Canvas2D renderer for WebCodecs"), n || (n = new
|
|
9051
|
+
this.logger.info("Switching to Canvas2D renderer for WebCodecs"), n || (n = new Vn(), n.load(), this.subscribeToContextLost(n), this.videoFrameCanvas2DRenderer = n);
|
|
9092
9052
|
let e = this.videoRenderer.canvas, r = n.canvas;
|
|
9093
9053
|
if (e.parentElement) try {
|
|
9094
9054
|
e.parentElement.replaceChild(r, e);
|
|
@@ -9182,7 +9142,7 @@ var pv = /* @__PURE__ */ new WeakMap(), mv = class {
|
|
|
9182
9142
|
}
|
|
9183
9143
|
getActiveCues(e) {
|
|
9184
9144
|
let t = T(pv, this).find((e) => e.mode === "showing");
|
|
9185
|
-
return t ? t.cues.filter(({ startTime: t, endTime: n }) => e >= t && e
|
|
9145
|
+
return t ? t.cues.filter(({ startTime: t, endTime: n }) => e >= t && e <= n) : [];
|
|
9186
9146
|
}
|
|
9187
9147
|
}, hv = (e, t) => {
|
|
9188
9148
|
let n;
|
|
@@ -9418,7 +9378,7 @@ var yv, bv = class {
|
|
|
9418
9378
|
volume: this.volume
|
|
9419
9379
|
};
|
|
9420
9380
|
jt(e, this.volumeState) || (this.volumeState = e, this.emitter.emit("volume state", this.volumeState));
|
|
9421
|
-
}), this.logger = n, this.emitter = t, this.pool = r, this._userProvidedMuted = a, this.offscreenCanvas = u, this.emitter.on("target buffer time", this.onTargetBufferTime), this.mediaElement = new
|
|
9381
|
+
}), this.logger = n, this.emitter = t, this.pool = r, this._userProvidedMuted = a, this.offscreenCanvas = u, this.emitter.on("target buffer time", this.onTargetBufferTime), this.mediaElement = new Ds({
|
|
9422
9382
|
poster: l,
|
|
9423
9383
|
type: c,
|
|
9424
9384
|
muted: a,
|
|
@@ -9541,7 +9501,7 @@ function wv({ initSegments: e, pendingSamples: t }) {
|
|
|
9541
9501
|
var Tv = class {
|
|
9542
9502
|
constructor(n, a, s) {
|
|
9543
9503
|
var u = this;
|
|
9544
|
-
e(this, "maxChunkSize", 20), e(this, "minConsecutiveErrorsBeforeEmit", 5), e(this, "maxSecondsInBuffer", 60), e(this, "logger", void 0), e(this, "timers", P.create()), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "mediaSource", new
|
|
9504
|
+
e(this, "maxChunkSize", 20), e(this, "minConsecutiveErrorsBeforeEmit", 5), e(this, "maxSecondsInBuffer", 60), e(this, "logger", void 0), e(this, "timers", P.create()), e(this, "emitter", void 0), e(this, "mediaElement", void 0), e(this, "mediaSource", new ms()), e(this, "trackContexts", /* @__PURE__ */ new Map()), e(this, "autoRecoverFromMediaErrors", !0), e(this, "quotaErrorCount", 0), e(this, "recoveredFromErrorCount", 0), e(this, "sourceOpenStartTime", performance.now()), e(this, "sourceOpenEndTime", performance.now()), e(this, "pendingTracksToAddSourceBuffers", void 0), e(this, "hasAddedInitialPosterFrame", !0), e(this, "videoKeyframeTimestamps", []), e(this, "isReopening", !1), e(this, "playbackStallCount", 0), e(this, "hasStartedPlayback", !1), e(this, "isPlaybackStalled", !1), e(this, "load", () => {
|
|
9545
9505
|
this.emitter.on("init segment", this.init), this.emitter.on("coded sample", this.onCodedSample), this.emitter.on("flush buffers", this.flushBuffers), this.emitter.on("fragment", this.onFragment);
|
|
9546
9506
|
}), e(this, "unload", () => {
|
|
9547
9507
|
this.logger.debug("Unloading module..."), this.emitter.off("init segment", this.init), this.emitter.off("coded sample", this.onCodedSample), this.emitter.off("flush buffers", this.flushBuffers), this.emitter.off("fragment", this.onFragment), this.mediaSource.off("source ended", this.onSourceEnded), this.mediaSource.off("source open", this.onSourceOpen), this.mediaElement.removeEventListener("error", this.onMediaElementError), this.mediaElement.removeEventListener("waiting", this.onPlaybackStall), this.mediaElement.removeEventListener("stalled", this.onPlaybackStall), this.mediaElement.removeEventListener("playing", this.onPlaybackProgress), this.mediaElement.removeEventListener("pause", this.onPlaybackPauseOrSeek), this.mediaElement.removeEventListener("seeking", this.onPlaybackPauseOrSeek), this.mediaSource.detach(this.mediaElement), this.trackContexts.forEach((e) => {
|
|
@@ -9572,7 +9532,7 @@ var Tv = class {
|
|
|
9572
9532
|
let e = [];
|
|
9573
9533
|
this.trackContexts.forEach((t) => {
|
|
9574
9534
|
t.pendingSamples = [], t.pendingSamplesOffset = 0, t.hasFirstSync = !1, t.state !== "uninitialized" && this.mediaSource.isOpen() && e.push(t.sourceBuffer.removeBuffer(0, Infinity).catch((e) => {
|
|
9575
|
-
if (!(e instanceof
|
|
9535
|
+
if (!(e instanceof fs)) throw e;
|
|
9576
9536
|
}));
|
|
9577
9537
|
}), Promise.all(e).then(() => this.emitter.emit("buffers flushed")).catch((e) => this.logger.error("Failed to remove buffer", e));
|
|
9578
9538
|
}), e(this, "setTrackContexts", (e = /* @__PURE__ */ new Map()) => {
|
|
@@ -9632,7 +9592,7 @@ var Tv = class {
|
|
|
9632
9592
|
if (t.mimeType !== n.sourceBufferMimeType) try {
|
|
9633
9593
|
yield n.sourceBuffer.changeType(t.mimeType), n.sourceBufferMimeType = t.mimeType;
|
|
9634
9594
|
} catch (r) {
|
|
9635
|
-
if (r instanceof
|
|
9595
|
+
if (r instanceof fs) throw u.logger.debug("Abandoning source buffer setup for a disposed buffer", { type: t.type }), r;
|
|
9636
9596
|
u.logger.warn("changeType failed, recreating source buffer", {
|
|
9637
9597
|
from: n.sourceBufferMimeType,
|
|
9638
9598
|
to: t.mimeType,
|
|
@@ -9677,7 +9637,7 @@ var Tv = class {
|
|
|
9677
9637
|
let n = this.trackContexts.get(e.type);
|
|
9678
9638
|
if (!n) throw i(e.type, e.renditionId);
|
|
9679
9639
|
n.state === "initialized" && (n.mimeType = t);
|
|
9680
|
-
let r =
|
|
9640
|
+
let r = qo({
|
|
9681
9641
|
codec: e.codec,
|
|
9682
9642
|
timescale: e.timescale,
|
|
9683
9643
|
initData: e.data
|
|
@@ -9698,7 +9658,7 @@ var Tv = class {
|
|
|
9698
9658
|
if (yield r.sourceBuffer.removeBuffer(e, Infinity), r.mimeType !== r.sourceBufferMimeType && r.sourceBuffer.changeType) try {
|
|
9699
9659
|
yield r.sourceBuffer.changeType(r.mimeType), r.sourceBufferMimeType = r.mimeType;
|
|
9700
9660
|
} catch (e) {
|
|
9701
|
-
if (e instanceof
|
|
9661
|
+
if (e instanceof fs) throw e;
|
|
9702
9662
|
u.logger.warn("changeType failed", {
|
|
9703
9663
|
from: r.sourceBufferMimeType,
|
|
9704
9664
|
to: r.mimeType,
|
|
@@ -9713,7 +9673,7 @@ var Tv = class {
|
|
|
9713
9673
|
let t = r.sequenceNumber;
|
|
9714
9674
|
if ("fragmented" in n) for (let t of e) "initData" in t && (yield r.sourceBuffer.appendBuffer(t.data, t.initData));
|
|
9715
9675
|
else {
|
|
9716
|
-
let n =
|
|
9676
|
+
let n = es(e, t++);
|
|
9717
9677
|
yield r.sourceBuffer.appendBuffer(n);
|
|
9718
9678
|
}
|
|
9719
9679
|
r.sequenceNumber = t, r.consecutiveQuotaExceededErrorCount = 0, r.successfulAppendCalls++;
|
|
@@ -9774,7 +9734,7 @@ var Tv = class {
|
|
|
9774
9734
|
this.logger.debug("Suppressing append error from stale track context", { type: e.type });
|
|
9775
9735
|
return;
|
|
9776
9736
|
}
|
|
9777
|
-
if (n instanceof
|
|
9737
|
+
if (n instanceof fs) {
|
|
9778
9738
|
this.logger.debug("Suppressing append error from a disposed source buffer", { type: e.type });
|
|
9779
9739
|
return;
|
|
9780
9740
|
}
|
|
@@ -9804,7 +9764,7 @@ var Tv = class {
|
|
|
9804
9764
|
});
|
|
9805
9765
|
}), e(this, "onSourceOpen", () => {
|
|
9806
9766
|
this.logger.debug("source opened"), this.sourceOpenEndTime = performance.now(), this.isReopening = !1, this.pendingTracksToAddSourceBuffers && (this.setSourceBuffers(this.pendingTracksToAddSourceBuffers).catch((e) => {
|
|
9807
|
-
e instanceof
|
|
9767
|
+
e instanceof fs || this.logger.error("Failed to set source buffers after source open", e);
|
|
9808
9768
|
}), this.pendingTracksToAddSourceBuffers = void 0);
|
|
9809
9769
|
}), e(this, "reopenMediaSource", (e) => {
|
|
9810
9770
|
this.logger.info("Re-opening MediaSource", { reason: e }), this.isReopening = !0, this.recoveredFromErrorCount++;
|
|
@@ -10885,16 +10845,16 @@ var cy = class {
|
|
|
10885
10845
|
}, ly = 6, uy = (e) => {
|
|
10886
10846
|
let t = [e], n = 0, r = 0, i = !1, a = (e, t) => {
|
|
10887
10847
|
var i, a;
|
|
10888
|
-
if (e.flags &&
|
|
10848
|
+
if (e.flags && ns(e.flags)) {
|
|
10889
10849
|
var o;
|
|
10890
10850
|
n = (o = e.compositionTimeOffset) == null ? 0 : o;
|
|
10891
10851
|
}
|
|
10892
10852
|
e.timestamp += n, e.compositionTimeOffset = ((i = e.compositionTimeOffset) == null ? 0 : i) - n;
|
|
10893
|
-
let s = e.timestamp / e.timescale, c = t.flags &&
|
|
10853
|
+
let s = e.timestamp / e.timescale, c = t.flags && ns(t.flags) ? (a = t.compositionTimeOffset) == null ? 0 : a : n, l = (t.timestamp + c) / t.timescale, u = Math.max(0, Math.round((l - s) * e.timescale));
|
|
10894
10854
|
return u > 0 && (r = u), O(O({}, e), {}, { duration: u > 0 ? u : r });
|
|
10895
10855
|
};
|
|
10896
10856
|
return (e, n = !1) => {
|
|
10897
|
-
if (e.flags &&
|
|
10857
|
+
if (e.flags && ns(e.flags) && n && (i = !i), !(n && t.length < ly && i) && t.length > 0) {
|
|
10898
10858
|
i = !1;
|
|
10899
10859
|
let n = e;
|
|
10900
10860
|
for (let e = t.length - 1; e > 0; e--) {
|
|
@@ -10928,7 +10888,7 @@ var cy = class {
|
|
|
10928
10888
|
if (vn(t)) return O(O({}, e), {}, {
|
|
10929
10889
|
type: "video",
|
|
10930
10890
|
codec: t.codec,
|
|
10931
|
-
isSync:
|
|
10891
|
+
isSync: ns(e.flags),
|
|
10932
10892
|
data: e.payload,
|
|
10933
10893
|
duration: 0,
|
|
10934
10894
|
width: t.width,
|
|
@@ -10941,7 +10901,7 @@ var cy = class {
|
|
|
10941
10901
|
sampleRate: t.sampleRate,
|
|
10942
10902
|
codec: t.codec,
|
|
10943
10903
|
language: t.language,
|
|
10944
|
-
isSync:
|
|
10904
|
+
isSync: ns(e.flags),
|
|
10945
10905
|
data: e.payload,
|
|
10946
10906
|
duration: 0
|
|
10947
10907
|
});
|
|
@@ -11079,7 +11039,7 @@ var cy = class {
|
|
|
11079
11039
|
if (!this.hasCalledConnect) {
|
|
11080
11040
|
if (this.hasCalledConnect = !0, Object.values(this.modules).forEach((e) => {
|
|
11081
11041
|
e && "load" in e && e.load();
|
|
11082
|
-
}), this.unsuspend(), this.playbackSource instanceof
|
|
11042
|
+
}), this.unsuspend(), this.playbackSource instanceof Ds) {
|
|
11083
11043
|
var e, t;
|
|
11084
11044
|
(e = (t = this.playbackSource).load) == null || e.call(t);
|
|
11085
11045
|
}
|
|
@@ -11155,7 +11115,7 @@ var cy = class {
|
|
|
11155
11115
|
this.emit("text tracks", this.textTracks);
|
|
11156
11116
|
}), e(this, "cleanupTextTracks", (e = this.currentTime - 2e4) => {
|
|
11157
11117
|
T(Oy, this).forEach((t) => {
|
|
11158
|
-
if (t.cues) for (let n of
|
|
11118
|
+
if (t.cues) for (let n of t.cues) n.endTime * 1e3 < e - 2e3 && t.removeCue(n);
|
|
11159
11119
|
});
|
|
11160
11120
|
}), e(this, "filterRenditions", function() {
|
|
11161
11121
|
var e = t(function* (e) {
|
|
@@ -11167,7 +11127,7 @@ var cy = class {
|
|
|
11167
11127
|
}
|
|
11168
11128
|
if (!vn(e) || !i.isSupportedVideoCodecProfile(e.codec, e.codecString)) return !1;
|
|
11169
11129
|
if (!i.willUseMediaSource()) return i.isWebCodecsVideoAvailable(i.channelId) ? i.webCodecsRenditionSupport.checkVideoSupport(e) : !0;
|
|
11170
|
-
let n = yield
|
|
11130
|
+
let n = yield Os(e);
|
|
11171
11131
|
if (!n.supported) return !1;
|
|
11172
11132
|
if (e.codec === "av1" && !n.smooth && !n.powerEfficient) return i.logger.debug("discarding av1 rendition, neither smooth nor power efficient", {
|
|
11173
11133
|
codecString: e.codecString,
|
|
@@ -11286,7 +11246,7 @@ var cy = class {
|
|
|
11286
11246
|
var r;
|
|
11287
11247
|
yield (r = i.modules.mseModule) == null ? void 0 : r.setSourceBuffers(n);
|
|
11288
11248
|
} catch (e) {
|
|
11289
|
-
throw e instanceof
|
|
11249
|
+
throw e instanceof fs ? (i.logger.debug("Abandoning decoding module setup for a disposed source buffer"), new y("Source buffer setup was superseded", {
|
|
11290
11250
|
code: "start_failed",
|
|
11291
11251
|
isFatal: !1,
|
|
11292
11252
|
type: "internal",
|
|
@@ -11340,7 +11300,7 @@ var cy = class {
|
|
|
11340
11300
|
}), e(this, "pause", () => {
|
|
11341
11301
|
this.options.get("pauseSupportEnabled") && this.playbackState !== "paused" && (this.playbackSource.pause(), this.hasCalledConnect && this.suspend());
|
|
11342
11302
|
}), e(this, "registerDebugInstance", () => {
|
|
11343
|
-
|
|
11303
|
+
Es(this);
|
|
11344
11304
|
}), e(this, "play", () => {
|
|
11345
11305
|
var e;
|
|
11346
11306
|
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();
|
|
@@ -11355,12 +11315,12 @@ var cy = class {
|
|
|
11355
11315
|
}), e(this, "resetModules", () => {
|
|
11356
11316
|
Object.values(this.modules).forEach((e) => {
|
|
11357
11317
|
e && "reset" in e && e.reset();
|
|
11358
|
-
}), this.playbackSource instanceof
|
|
11318
|
+
}), this.playbackSource instanceof Ds && this.modules.adaptivity.reset(Ey), this.sampleProcessingSesssions.clear(), this.playbackSource.currentTime = 0, this.playbackSource.isActivated = !1;
|
|
11359
11319
|
}), e(this, "getRuntimeInfo", () => {
|
|
11360
11320
|
let e = this.modules.canvasModule instanceof bv ? !0 : void 0;
|
|
11361
11321
|
return O({
|
|
11362
11322
|
uptime: this.uptime,
|
|
11363
|
-
version: "4.5.0
|
|
11323
|
+
version: "4.5.0",
|
|
11364
11324
|
clientId: this.clientId,
|
|
11365
11325
|
sessionId: this.sessionId,
|
|
11366
11326
|
channelId: this.channelId,
|
|
@@ -11417,7 +11377,7 @@ var cy = class {
|
|
|
11417
11377
|
options: this.options,
|
|
11418
11378
|
onConnectInfo: this.onConnectInfo
|
|
11419
11379
|
}), ee = Gv.create(this.logger.createContext("SubscriptionModule"), this.emitter, o), _ = Vv.create(this.emitter, ee), v = zv.create(this.emitter, this.logger.createContext("QualityOfServiceModule"), _), te = Fv.create(this.emitter, this.logger.createContext("PlaybackModule"), this, this.options.get("minBufferTime"));
|
|
11420
|
-
this.encryptedMediaExtensions = new
|
|
11380
|
+
this.encryptedMediaExtensions = new Ur(this.emitter, this.logger.createContext("EncryptedMediaExtensions"), r.drm), this.drm = {
|
|
11421
11381
|
setHeaders: (e) => {
|
|
11422
11382
|
this.encryptedMediaExtensions.headers = e;
|
|
11423
11383
|
},
|
|
@@ -11427,7 +11387,7 @@ var cy = class {
|
|
|
11427
11387
|
};
|
|
11428
11388
|
let b = Y_.create(this.emitter), ne = this.options.get("poster"), x = ne === !0 ? this.getThumbnailUrl() : ne || void 0, S, w, D;
|
|
11429
11389
|
if (this.willUseMediaSource()) {
|
|
11430
|
-
let e = new
|
|
11390
|
+
let e = new Ds({
|
|
11431
11391
|
type: this.options.get("media") === "audio" ? "audio" : "video",
|
|
11432
11392
|
autoplay: !1,
|
|
11433
11393
|
muted: this.options.get("muted") || this.options.get("media") === "video",
|
|
@@ -11435,7 +11395,7 @@ var cy = class {
|
|
|
11435
11395
|
logger: this.logger.createContext("MediaElement"),
|
|
11436
11396
|
poster: x
|
|
11437
11397
|
});
|
|
11438
|
-
e.on("buffer state", (e) => this.onMediaElementBufferState(e, S)), e.on("needs user input", (e) => this.emitter.emit("needs user input", e)), e.on("volume state", (e) => this.emit("volume state", e)), e.on("media element state", (e) => this.onMediaElementState(e)), this.element = e.element, this.playbackSource = e,
|
|
11398
|
+
e.on("buffer state", (e) => this.onMediaElementBufferState(e, S)), e.on("needs user input", (e) => this.emitter.emit("needs user input", e)), e.on("volume state", (e) => this.emit("volume state", e)), e.on("media element state", (e) => this.onMediaElementState(e)), this.element = e.element, this.playbackSource = e, Ur.isSupported() && this.encryptedMediaExtensions.attach(e.element), S = Tv.create(this.logger.createContext("MseModule"), this.emitter, this.element), this.options.get("pauseSupportEnabled") || (w = ay.create(this.logger.createContext("UnpauseModule"), e, b)), this.options.get("pictureInPictureEnabled") && this.emitter.emit("add picture in picture listener", { element: e.element });
|
|
11439
11399
|
} else if (this.options.get("streamToMediaElementEnabled") && St(this.browser)) {
|
|
11440
11400
|
let e = bv.create(this.emitter, this.logger.createContext("ModernCanvasModule"), this.pool, this, {
|
|
11441
11401
|
type: this.options.get("media") === "audio" ? "audio" : "video",
|
|
@@ -11452,7 +11412,7 @@ var cy = class {
|
|
|
11452
11412
|
let e;
|
|
11453
11413
|
e = vv.create(this.emitter, this.logger.createContext("LegacyCanvasModule"), this.pool, this, this.options.get("muted") || this.options.get("media") === "video", this.options.get("volume"), () => {
|
|
11454
11414
|
this.setElement(e.element());
|
|
11455
|
-
}, this.options.get("minBufferTime")), this.element = e.element(), this.playbackSource = e, D = e, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new
|
|
11415
|
+
}, this.options.get("minBufferTime")), this.element = e.element(), this.playbackSource = e, D = e, this.options.get("iosWakeLockEnabled") && (this.wakeLock = new _s());
|
|
11456
11416
|
}
|
|
11457
11417
|
this.emitter.on("channel reset", this.resetModules), this.emitter.on("no data timeout", this.resetModules), this.emitter.on("media element state", (e) => this.onMediaElementState(e)), this.emitter.on("volume state", (e) => this.emit("volume state", e)), this.options.get("pauseSupportEnabled") || this.emitter.on("exit picture in picture", () => h.setTimeout(() => this.play(), 0)), this.emitter.on("constraint cap changed", (e) => {
|
|
11458
11418
|
this.logger.info("new cap set", { cap: e }), this.alignSizeAndBitRate(this.targetSubscription);
|
|
@@ -11475,12 +11435,12 @@ var cy = class {
|
|
|
11475
11435
|
includeStats: !1,
|
|
11476
11436
|
interval: 5e3
|
|
11477
11437
|
}, this),
|
|
11478
|
-
bufferTime:
|
|
11438
|
+
bufferTime: Vs.create(this.emitter, this.logger.createContext("BufferTimeModule"), v, this, {
|
|
11479
11439
|
maxBufferTime: this.options.get("maxBufferTime"),
|
|
11480
11440
|
minBufferTime: this.options.get("minBufferTime")
|
|
11481
11441
|
}),
|
|
11482
11442
|
incomingData: ev.create(this.emitter),
|
|
11483
|
-
adaptivity:
|
|
11443
|
+
adaptivity: Rs.create(this.emitter, this.logger.createContext("AdaptivityModule"), v, { cooldownTime: Math.max(this.options.get("minBufferTime"), 2e3) }),
|
|
11484
11444
|
constraintCap: P_.create(this.emitter, this.element, _, this.options.get("abrEnabled") ? this.options.get("sizeBasedResolutionCapEnabled") : !1),
|
|
11485
11445
|
event: Q_.create(this.emitter, this.logger.createContext("EventModule"), se),
|
|
11486
11446
|
sync: se,
|
|
@@ -11617,7 +11577,7 @@ var cy = class {
|
|
|
11617
11577
|
}), this.emitter.on("channel switch timeout", (e) => {
|
|
11618
11578
|
this.emit("error", u(e)), this.emit("channel switch failed", { channelId: this.currentSubscription.channelId });
|
|
11619
11579
|
}), this.emitter.on("received data", (e) => {
|
|
11620
|
-
let t = this.modules.subscription.getCurrentSubscription(), n =
|
|
11580
|
+
let t = this.modules.subscription.getCurrentSubscription(), n = ss(e);
|
|
11621
11581
|
if (!t) {
|
|
11622
11582
|
this.logger.warn("Received unwanted message", O({}, n));
|
|
11623
11583
|
return;
|
|
@@ -11650,7 +11610,7 @@ var cy = class {
|
|
|
11650
11610
|
isKeyframe: i.startsWithKeyframe()
|
|
11651
11611
|
}), i.fragment().emsgs.forEach((e) => {
|
|
11652
11612
|
if (!e.presentationTime) return;
|
|
11653
|
-
let t =
|
|
11613
|
+
let t = ui(e.data);
|
|
11654
11614
|
t && this.modules.event.addEvent({
|
|
11655
11615
|
id: e.id,
|
|
11656
11616
|
timestamp: e.presentationTime / e.timescale * 1e3 - this.modules.sync.getTimeshiftOffset(),
|
|
@@ -11666,8 +11626,8 @@ var cy = class {
|
|
|
11666
11626
|
} else if (d === "h265") {
|
|
11667
11627
|
var l, u, f;
|
|
11668
11628
|
let e = (l = a == null || (u = a.hvc1) == null ? void 0 : u.data()) == null ? a == null || (f = a.hev1) == null ? void 0 : f.data() : l;
|
|
11669
|
-
e && (h =
|
|
11670
|
-
} else if (d === "av1" && a != null && a.av01) h =
|
|
11629
|
+
e && (h = ci(e));
|
|
11630
|
+
} else if (d === "av1" && a != null && a.av01) h = Do(a.av01.data());
|
|
11671
11631
|
else if (d === "aac") {
|
|
11672
11632
|
var p;
|
|
11673
11633
|
h = a == null || (p = a.mp4a) == null || (p = p.esds) == null ? void 0 : p.decoderConfig;
|
|
@@ -11729,24 +11689,18 @@ var cy = class {
|
|
|
11729
11689
|
let t = e.channelId;
|
|
11730
11690
|
T(ky, i) && (yield T(ky, i));
|
|
11731
11691
|
let n = i.modules.renditions.getRendition(e.renditionId, t);
|
|
11732
|
-
if (!
|
|
11733
|
-
if (
|
|
11692
|
+
if (!is(e.flags)) {
|
|
11693
|
+
if (as(e.flags)) {
|
|
11734
11694
|
let t = new TextDecoder().decode(e.payload), n = i.modules.sync.getTimeshiftOffset();
|
|
11735
11695
|
if (e.renditionId !== 0) {
|
|
11736
11696
|
let e = ie(t);
|
|
11737
11697
|
if (e && e.language !== void 0) {
|
|
11738
|
-
let t = new
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
let a = n / 1e3, o = T(Oy, i).find((t) => t.language === e.language), s = a - T(Dy, i);
|
|
11745
|
-
if (E(Dy, i, a), o) {
|
|
11746
|
-
if (o.cues) for (let e of o.cues) e.startTime -= s, e.endTime -= s;
|
|
11747
|
-
for (let e of r) {
|
|
11748
|
-
let t = new VTTCue(e.startTime - a, e.endTime - a, e.text);
|
|
11749
|
-
o.addCue(t);
|
|
11698
|
+
let t = new Cs().parse(e.content || ""), r = n / 1e3, a = T(Oy, i).find((t) => t.language === e.language), o = r - T(Dy, i);
|
|
11699
|
+
if (E(Dy, i, r), a) {
|
|
11700
|
+
if (a.cues) for (let e of a.cues) e.startTime -= o, e.endTime -= o;
|
|
11701
|
+
for (let e of t) {
|
|
11702
|
+
let t = new VTTCue(e.startTime - r, e.endTime - r, e.text);
|
|
11703
|
+
a.addCue(t);
|
|
11750
11704
|
}
|
|
11751
11705
|
}
|
|
11752
11706
|
}
|
|
@@ -11758,12 +11712,12 @@ var cy = class {
|
|
|
11758
11712
|
} else if (n != null && n.codec) {
|
|
11759
11713
|
let r = ue(n.codec);
|
|
11760
11714
|
if (r === "text") throw Error("Subtitles are not supported");
|
|
11761
|
-
if (i.modules.incomingData.add(r, e.payload.byteLength),
|
|
11715
|
+
if (i.modules.incomingData.add(r, e.payload.byteLength), rs(e.flags)) {
|
|
11762
11716
|
let a = O(O({
|
|
11763
11717
|
type: r,
|
|
11764
11718
|
data: e.payload,
|
|
11765
11719
|
codec: n.codec
|
|
11766
|
-
}, e), {}, { channelId: t }), o =
|
|
11720
|
+
}, e), {}, { channelId: t }), o = Jo(a.codec, a.payload);
|
|
11767
11721
|
o && i.sizes.set(a.renditionId, o);
|
|
11768
11722
|
let s = bn({
|
|
11769
11723
|
codec: n.codec,
|