1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-02-10 17:00:54 +01:00

p2p-media-loader-hlsjs & p2p-media-loader-core v1.0.4 -> v1.0.5

This commit is contained in:
nobody 2024-09-09 08:36:43 +02:00
parent 8b395f44ef
commit eac0880c05
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
5 changed files with 65 additions and 57 deletions

View File

@ -1454,9 +1454,9 @@ https://cdn.jsdelivr.net/npm/ngx-bootstrap@18.0.2/datepicker/bs-datepicker.css
https://cdn.jsdelivr.net/npm/ngx-bootstrap@6.2.0/datepicker/bs-datepicker.css
https://cdn.jsdelivr.net/npm/object-assign@4.1.1/index.js
https://cdn.jsdelivr.net/npm/p2p-media-loader-core@0.6.2/build/p2p-media-loader-core.min.js
https://cdn.jsdelivr.net/npm/p2p-media-loader-core@1.0.4/dist/p2p-media-loader-core.es.min.js
https://cdn.jsdelivr.net/npm/p2p-media-loader-core@1.0.5/dist/p2p-media-loader-core.es.min.js
https://cdn.jsdelivr.net/npm/p2p-media-loader-hlsjs@0.6.2/build/p2p-media-loader-hlsjs.min.js
https://cdn.jsdelivr.net/npm/p2p-media-loader-hlsjs@1.0.4/dist/p2p-media-loader-hlsjs.es.min.js
https://cdn.jsdelivr.net/npm/p2p-media-loader-hlsjs@1.0.5/dist/p2p-media-loader-hlsjs.es.min.js
https://cdn.jsdelivr.net/npm/plyr@3.7.8/dist/plyr.css
https://cdn.jsdelivr.net/npm/plyr@3.7.8/dist/plyr.min.js
https://cdn.jsdelivr.net/npm/raven-js@3.27.2/dist/raven.min.js

View File

@ -369,7 +369,7 @@ targets.setLastVersion = function (type, version) {
if (type.startsWith('/owl-carousel/2.')) return '2.3.4';
if (type.startsWith('/p2p-media-loader-core') || type.startsWith('/p2p-media-loader-hlsjs')) {
if (helpers.compareVersion('0.6.2', version)) return '0.6.2'; // <= v0.6.2
return '1.0.4';
return '1.0.5';
}
if (type.startsWith('/p5.js/0.')) return '0.10.2';
if (type.startsWith('/p5.js/1.')) return '1.10.0';

View File

@ -35,6 +35,7 @@
<li>instantsearch.js v4.73.4 -> v4.74.0</li>
<li>jquery.tablesorter v2.31.3 -> v2.32.0</li>
<li>libphonenumber-js v1.11.5 -> v1.11.7</li>
<li>p2p-media-loader-hlsjs & p2p-media-loader-core v1.0.4 -> v1.0.5</li>
</ul>
</div>
<div id="generator-section">

View File

@ -175,7 +175,7 @@ function V(s) {
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
}
var me, ye, Wt = { exports: {} };
function Xn() {
function Zn() {
if (ye) return me;
ye = 1;
var s = 1e3, t = 60 * s, e = 60 * t, n = 24 * e, r = 7 * n, i = 365.25 * n;
@ -246,7 +246,7 @@ function Xn() {
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(a));
};
}
var Zn = function(s) {
var Xn = function(s) {
function t(r) {
let i, o, a, h = null;
function g(...d) {
@ -292,7 +292,7 @@ var Zn = function(s) {
for (i = 0, o = t.skips.length; i < o; i++) if (t.skips[i].test(r)) return !1;
for (i = 0, o = t.names.length; i < o; i++) if (t.names[i].test(r)) return !0;
return !1;
}, t.humanize = Xn(), t.destroy = function() {
}, t.humanize = Zn(), t.destroy = function() {
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
}, Object.keys(s).forEach((r) => {
t[r] = s[r];
@ -324,7 +324,10 @@ var Zn = function(s) {
}
return !n && wt !== void 0 && "env" in wt && (n = wt.env.DEBUG), n;
}, t.useColors = function() {
return typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs) ? !0 : typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/) ? !1 : typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
if (typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return !0;
if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
let n;
return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && (n = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(n[1], 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}, t.storage = function() {
try {
return localStorage;
@ -336,7 +339,7 @@ var Zn = function(s) {
n || (n = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
};
})(), t.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], t.log = console.debug || console.log || (() => {
}), s.exports = Zn(t);
}), s.exports = Xn(t);
const { formatters: e } = s.exports;
e.j = function(n) {
try {
@ -666,13 +669,13 @@ function Kt(s) {
}
return t;
}
let Xt, Zt;
let Zt, Xt;
if (typeof TextDecoder < "u") {
const s = new TextDecoder();
Xt = function(t) {
Zt = function(t) {
return s.decode(t);
};
} else Xt = function(s) {
} else Zt = function(s) {
const t = s.byteLength;
let e = "", n = 0;
for (; n < t; ) {
@ -692,11 +695,11 @@ if (typeof TextDecoder < "u") {
};
if (typeof TextEncoder < "u") {
const s = new TextEncoder();
Zt = function(t, e, n = 0, r = Kt(e)) {
Xt = function(t, e, n = 0, r = Kt(e)) {
const i = Math.min(r, t.byteLength - n);
return s.encodeInto(e, t.subarray(n, n + i)), i;
};
} else Zt = function(s, t, e = 0, n = Kt(t)) {
} else Xt = function(s, t, e = 0, n = Kt(t)) {
const r = Math.min(n, s.byteLength - e);
s = s.subarray(e, e + r);
let i = 0, o = 0;
@ -712,7 +715,7 @@ if (typeof TextEncoder < "u") {
}
return r;
};
var ls = { byteLength: Kt, toString: Xt, write: Zt };
var ls = { byteLength: Kt, toString: Zt, write: Xt };
function qe(s) {
return 2 * s.length;
}
@ -1375,7 +1378,7 @@ const C = V(function(s, t, e) {
}
}), Et = "0123456789abcdef", qn = [], Tt = [];
for (let s = 0; s < 256; s++) qn[s] = Et[s >> 4 & 15] + Et[15 & s], s < 16 && (s < 10 ? Tt[48 + s] = s : Tt[87 + s] = s);
const Z = (s) => {
const X = (s) => {
const t = s.length;
let e = "", n = 0;
for (; n < t; ) e += qn[s[n++]];
@ -1387,7 +1390,7 @@ const Z = (s) => {
return n;
};
for (var Js = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ys = typeof Uint8Array > "u" ? [] : new Uint8Array(256), gt = 0; gt < 64; gt++) Ys[Js.charCodeAt(gt)] = gt;
const Ks = new TextDecoder(), On = (s, t) => Ks.decode(s), Xs = new TextEncoder(), ge = (s) => Xs.encode(s), G = (s) => {
const Ks = new TextDecoder(), On = (s, t) => Ks.decode(s), Zs = new TextEncoder(), ge = (s) => Zs.encode(s), G = (s) => {
let t, e = "", n = 0;
const r = s.length;
for (; n < r; ) t = s.charCodeAt(n++), e += Et[t >> 4] + Et[15 & t];
@ -1403,7 +1406,7 @@ se.subtle || se.webkitSubtle;
const It = (s) => {
const t = new Uint8Array(s);
return se.getRandomValues(t);
}, Zs = P("simple-peer"), Mt = 65536;
}, Xs = P("simple-peer"), Mt = 65536;
function Qe(s) {
return s.replace(/a=ice-options:trickle\s\n/g, "");
}
@ -1411,7 +1414,7 @@ let ot = class re extends Pn {
constructor(e) {
super(e = Object.assign({ allowHalfOpen: !1 }, e));
f(this, "_pc");
if (this.__objectMode = !!e.objectMode, this._id = Z(It(4)).slice(0, 7), this._debug("new peer %o", e), this.channelName = e.initiator ? e.channelName || Z(It(20)) : null, this.initiator = e.initiator || !1, this.channelConfig = e.channelConfig || re.channelConfig, this.channelNegotiated = this.channelConfig.negotiated, this.config = Object.assign({}, re.config, e.config), this.offerOptions = e.offerOptions || {}, this.answerOptions = e.answerOptions || {}, this.sdpTransform = e.sdpTransform || ((n) => n), this.trickle = e.trickle === void 0 || e.trickle, this.allowHalfTrickle = e.allowHalfTrickle !== void 0 && e.allowHalfTrickle, this.iceCompleteTimeout = e.iceCompleteTimeout || 5e3, this._destroying = !1, this._connected = !1, this.remoteAddress = void 0, this.remoteFamily = void 0, this.remotePort = void 0, this.localAddress = void 0, this.localFamily = void 0, this.localPort = void 0, !Jt) throw C(typeof window > "u" ? new Error("No WebRTC support: Specify `opts.wrtc` option in this environment") : new Error("No WebRTC support: Not a supported browser"), "ERR_WEBRTC_SUPPORT");
if (this.__objectMode = !!e.objectMode, this._id = X(It(4)).slice(0, 7), this._debug("new peer %o", e), this.channelName = e.initiator ? e.channelName || X(It(20)) : null, this.initiator = e.initiator || !1, this.channelConfig = e.channelConfig || re.channelConfig, this.channelNegotiated = this.channelConfig.negotiated, this.config = Object.assign({}, re.config, e.config), this.offerOptions = e.offerOptions || {}, this.answerOptions = e.answerOptions || {}, this.sdpTransform = e.sdpTransform || ((n) => n), this.trickle = e.trickle === void 0 || e.trickle, this.allowHalfTrickle = e.allowHalfTrickle !== void 0 && e.allowHalfTrickle, this.iceCompleteTimeout = e.iceCompleteTimeout || 5e3, this._destroying = !1, this._connected = !1, this.remoteAddress = void 0, this.remoteFamily = void 0, this.remotePort = void 0, this.localAddress = void 0, this.localFamily = void 0, this.localPort = void 0, !Jt) throw C(typeof window > "u" ? new Error("No WebRTC support: Specify `opts.wrtc` option in this environment") : new Error("No WebRTC support: Not a supported browser"), "ERR_WEBRTC_SUPPORT");
this._pcReady = !1, this._channelReady = !1, this._iceComplete = !1, this._iceCompleteTimer = null, this._channel = null, this._pendingCandidates = [], this._isNegotiating = !1, this._firstNegotiation = !0, this._batchedNegotiation = !1, this._queuedNegotiation = !1, this._sendersAwaitingStable = [], this._closingInterval = null, this._remoteTracks = [], this._remoteStreams = [], this._chunk = null, this._cb = null, this._interval = null;
try {
this._pc = new Jt(this.config);
@ -1689,7 +1692,7 @@ let ot = class re extends Pn {
}
_debug() {
const e = [].slice.call(arguments);
e[0] = "[" + this._id + "] " + e[0], Zs.apply(null, e);
e[0] = "[" + this._id + "] " + e[0], Xs.apply(null, e);
}
};
ot.WEBRTC_SUPPORT = !!Jt, ot.config = { iceServers: [{ urls: ["stun:stun.l.google.com:19302", "stun:global.stun.twilio.com:3478"] }], sdpSemantics: "unified-plan" }, ot.channelConfig = {};
@ -1701,7 +1704,7 @@ class Dn extends Pn {
constructor(t = {}) {
if (typeof t == "string" && (t = { url: t }), super(t = Object.assign({ allowHalfOpen: !1 }, t)), this.__objectMode = !!t.objectMode, t.objectMode != null && delete t.objectMode, t.url == null && t.socket == null) throw new Error("Missing required `url` or `socket` option");
if (t.url != null && t.socket != null) throw new Error("Must specify either `url` or `socket` option, not both");
if (this._id = Z(It(4)).slice(0, 7), this._debug("new websocket: %o", t), this.connected = !1, this._chunk = null, this._cb = null, this._interval = null, t.socket) this.url = t.socket.url, this._ws = t.socket, this.connected = t.socket.readyState === st.OPEN;
if (this._id = X(It(4)).slice(0, 7), this._debug("new websocket: %o", t), this.connected = !1, this._chunk = null, this._cb = null, this._interval = null, t.socket) this.url = t.socket.url, this._ws = t.socket, this.connected = t.socket.readyState === st.OPEN;
else {
this.url = t.url;
try {
@ -1930,7 +1933,7 @@ class oe extends er {
I("generating %s offers", t);
for (let a = 0; a < t; ++a) i();
function i() {
const a = Z(It(20));
const a = X(It(20));
I("creating peer (from _generateOffers)");
const h = n.peers[a] = n._createPeer({ initiator: !0 });
h.once("signal", (g) => {
@ -1966,7 +1969,7 @@ class ae extends un {
if (!t.infoHash) throw new Error("Option `infoHash` is required");
if (!t.announce) throw new Error("Option `announce` is required");
if (!wt.browser && !t.port) throw new Error("Option `port` is required");
this.peerId = typeof t.peerId == "string" ? t.peerId : Z(t.peerId), this._peerIdBuffer = ne(this.peerId), this._peerIdBinary = it(this.peerId), this.infoHash = typeof t.infoHash == "string" ? t.infoHash.toLowerCase() : Z(t.infoHash), this._infoHashBuffer = ne(this.infoHash), this._infoHashBinary = it(this.infoHash), F("new client %s", this.infoHash), this.destroyed = !1, this._port = t.port, this._getAnnounceOpts = t.getAnnounceOpts, this._rtcConfig = t.rtcConfig, this._userAgent = t.userAgent, this._proxyOpts = t.proxyOpts, this._wrtc = typeof t.wrtc == "function" ? t.wrtc() : t.wrtc;
this.peerId = typeof t.peerId == "string" ? t.peerId : X(t.peerId), this._peerIdBuffer = ne(this.peerId), this._peerIdBinary = it(this.peerId), this.infoHash = typeof t.infoHash == "string" ? t.infoHash.toLowerCase() : X(t.infoHash), this._infoHashBuffer = ne(this.infoHash), this._infoHashBinary = it(this.infoHash), F("new client %s", this.infoHash), this.destroyed = !1, this._port = t.port, this._getAnnounceOpts = t.getAnnounceOpts, this._rtcConfig = t.rtcConfig, this._userAgent = t.userAgent, this._proxyOpts = t.proxyOpts, this._wrtc = typeof t.wrtc == "function" ? t.wrtc() : t.wrtc;
let e = typeof t.announce == "string" ? [t.announce] : t.announce == null ? [] : t.announce;
e = e.map((i) => (ArrayBuffer.isView(i) && (i = On(i)), i[i.length - 1] === "/" && (i = i.substring(0, i.length - 1)), i)), e = Array.from(new Set(e));
const n = this._wrtc !== !1 && (!!this._wrtc || ot.WEBRTC_SUPPORT), r = (i) => {
@ -2112,7 +2115,7 @@ qt.crypt = function(s, t) {
const rr = V(Nn.exports), ir = `-PM${function(s) {
const t = s.split(".");
return `${t[0].padStart(2, "0")}${t[1].padStart(2, "0")}`;
}("1.0.4")}-`, or = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
}("1.0.5")}-`, or = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
function z(s) {
return `${s.type}-${s.index}`;
}
@ -2161,7 +2164,7 @@ function Ut(s) {
a in r && (o[a] = r[a]);
}), o;
}
var H = ((s) => (s[s.SegmentsAnnouncement = 0] = "SegmentsAnnouncement", s[s.SegmentRequest = 1] = "SegmentRequest", s[s.SegmentData = 2] = "SegmentData", s[s.SegmentDataSendingCompleted = 3] = "SegmentDataSendingCompleted", s[s.SegmentAbsent = 4] = "SegmentAbsent", s[s.CancelSegmentRequest = 5] = "CancelSegmentRequest", s))(H || {}), X = ((s) => (s[s.Min = -1] = "Min", s[s.Int = 0] = "Int", s[s.SimilarIntArray = 1] = "SimilarIntArray", s[s.String = 2] = "String", s[s.Max = 3] = "Max", s))(X || {});
var H = ((s) => (s[s.SegmentsAnnouncement = 0] = "SegmentsAnnouncement", s[s.SegmentRequest = 1] = "SegmentRequest", s[s.SegmentData = 2] = "SegmentData", s[s.SegmentDataSendingCompleted = 3] = "SegmentDataSendingCompleted", s[s.SegmentAbsent = 4] = "SegmentAbsent", s[s.CancelSegmentRequest = 5] = "CancelSegmentRequest", s))(H || {}), Z = ((s) => (s[s.Min = -1] = "Min", s[s.Int = 0] = "Int", s[s.SimilarIntArray = 1] = "SimilarIntArray", s[s.String = 2] = "String", s[s.Max = 3] = "Max", s))(Z || {});
function ar(s) {
const t = s < 0, e = function(i) {
const o = i.toString(2), a = i < 0 ? o.length : o.length + 1;
@ -2333,19 +2336,19 @@ function jn(s) {
for (; n < s.length; ) {
const r = String.fromCharCode(s[n]);
switch (n++, gr(s[n])) {
case X.Int:
case Z.Int:
{
const { number: i, byteLength: o } = Fn(s.slice(n));
e[r] = Number(i), n += o;
}
break;
case X.SimilarIntArray:
case Z.SimilarIntArray:
{
const { numbers: i, byteLength: o } = cr(s.slice(n));
e[r] = i.map((a) => Number(a)), n += o;
}
break;
case X.String: {
case Z.String: {
const { string: i, byteLength: o } = dr(s.slice(n));
e[r] = i, n += o;
}
@ -2355,7 +2358,7 @@ function jn(s) {
}
function gr(s) {
const t = s >> 4;
if (t <= X.Min || t >= X.Max) throw new Error("Not existing type");
if (t <= Z.Min || t >= Z.Max) throw new Error("Not existing type");
return t;
}
function Ot(s, t) {
@ -2598,7 +2601,11 @@ class Pt {
}(t.id);
}
}
class mr {
function mr() {
const s = /^((?!chrome|android).)*safari/i.test(navigator.userAgent), t = /\b(iPad|iPhone|Macintosh).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent);
return s || t;
}
class yr {
constructor(t, e, n, r, i) {
f(this, "streamShortId");
f(this, "client");
@ -2634,7 +2641,7 @@ class mr {
for (let p = 0; p < d; p++) g.push(or[Math.floor(62 * Math.random())]);
return g.join("");
}(r.trackerClientVersionPrefix);
this.client = new ae({ infoHash: Ge(o), peerId: Ge(a), announce: /^((?!chrome|android).)*safari/i.test(navigator.userAgent) ? r.announceTrackers.slice(0, 1) : r.announceTrackers, rtcConfig: this.config.rtcConfig }), this.client.on("peer", this.onReceivePeerConnection), this.client.on("warning", this.onTrackerClientWarning), this.client.on("error", this.onTrackerClientError), this.logger(`create new client;
this.client = new ae({ infoHash: Ge(o), peerId: Ge(a), announce: mr() ? r.announceTrackers.slice(0, 1) : r.announceTrackers, rtcConfig: this.config.rtcConfig }), this.client.on("peer", this.onReceivePeerConnection), this.client.on("warning", this.onTrackerClientWarning), this.client.on("error", this.onTrackerClientError), this.logger(`create new client;
stream: ${this.streamShortId}; hash: ${o}
peerId: ${a}`);
}
@ -2653,7 +2660,7 @@ peerId: ${a}`);
for (const t of this._peers.values()) t != null && t.peer && (yield t.peer);
}
}
function Xe(s, t) {
function Ze(s, t) {
for (const e of s.values()) {
const n = e.segments.get(t);
if (n) return n;
@ -2670,7 +2677,7 @@ function Ft(s, t, e) {
const { startTime: n, endTime: r } = s, { position: i, rate: o } = t;
return !(i + e * o < n || i > r);
}
class yr {
class _r {
constructor(t, e, n, r, i, o, a) {
f(this, "trackerClient");
f(this, "isAnnounceMicrotaskCreated", !1);
@ -2697,7 +2704,7 @@ class yr {
const h = function(g, d) {
return `v2-${g}-${$(d)}`;
}(this.config.swarmId ?? this.streamManifestUrl, this.stream);
this.trackerClient = new mr(h, this.stream, { onPeerConnected: this.onPeerConnected, onSegmentRequested: this.onSegmentRequested, onSegmentsAnnouncement: this.onSegmentAnnouncement }, this.config, this.eventTarget), this.segmentStorage.subscribeOnUpdate(this.stream, this.broadcastAnnouncement), this.trackerClient.start();
this.trackerClient = new yr(h, this.stream, { onPeerConnected: this.onPeerConnected, onSegmentRequested: this.onSegmentRequested, onSegmentsAnnouncement: this.onSegmentAnnouncement }, this.config, this.eventTarget), this.segmentStorage.subscribeOnUpdate(this.stream, this.broadcastAnnouncement), this.trackerClient.start();
}
downloadSegment(t) {
const e = [];
@ -2733,7 +2740,7 @@ class yr {
this.segmentStorage.unsubscribeFromUpdate(this.stream, this.broadcastAnnouncement), this.trackerClient.destroy();
}
}
class _r {
class br {
constructor(t, e, n, r, i, o, a) {
f(this, "loaders", /* @__PURE__ */ new Map());
f(this, "_currentLoaderItem");
@ -2742,7 +2749,7 @@ class _r {
}
createLoader(t) {
if (this.loaders.has(t.runtimeId)) throw new Error("Loader for this stream already exists");
const e = new yr(this.streamManifestUrl, t, this.requests, this.segmentStorage, this.config, this.eventTarget, () => {
const e = new _r(this.streamManifestUrl, t, this.requests, this.segmentStorage, this.config, this.eventTarget, () => {
this._currentLoaderItem.loader === e && this.onSegmentAnnouncement();
}), n = z(t);
return this.logger(`created new loader: ${n}`), { loader: e, stream: t, loggerInfo: z(t) };
@ -2770,10 +2777,10 @@ class _r {
this.loaders.clear();
}
}
let br = class {
let wr = class {
constructor(s, t, e, n, r, i) {
f(this, "currentAttempt");
f(this, "_failedAttempts", new wr());
f(this, "_failedAttempts", new Sr());
f(this, "finalData");
f(this, "bytes", []);
f(this, "_loadedBytes", 0);
@ -2816,7 +2823,7 @@ let br = class {
const { end: h, start: g } = o;
this._totalBytes = h - g + 1;
}
this.notReceivingBytesTimeout = new Sr(this.abortOnTimeout);
this.notReceivingBytesTimeout = new Cr(this.abortOnTimeout);
const { type: a } = this.segment.stream;
this._logger = P(`p2pml-core:request-${a}`);
}
@ -2879,7 +2886,7 @@ let br = class {
((r = this.currentAttempt) == null ? void 0 : r.downloadSource) === "http" && e[n](), t[n]();
}
};
class wr {
class Sr {
constructor() {
f(this, "attempts", []);
}
@ -2896,7 +2903,7 @@ class wr {
this.attempts = [];
}
}
class Sr {
class Cr {
constructor(t) {
f(this, "timeoutId");
f(this, "ms");
@ -2913,7 +2920,7 @@ class Sr {
clearTimeout(this.timeoutId), this.timeoutId = void 0;
}
}
class Cr {
class vr {
constructor(t, e, n, r, i) {
f(this, "requests", /* @__PURE__ */ new Map());
this.requestProcessQueueCallback = t, this.bandwidthCalculators = e, this.playback = n, this.config = r, this.eventTarget = i;
@ -2933,7 +2940,7 @@ class Cr {
}
getOrCreateRequest(t) {
let e = this.requests.get(t);
return e || (e = new br(t, this.requestProcessQueueCallback, this.bandwidthCalculators, this.playback, this.config, this.eventTarget), this.requests.set(t, e)), e;
return e || (e = new wr(t, this.requestProcessQueueCallback, this.bandwidthCalculators, this.playback, this.config, this.eventTarget), this.requests.set(t, e)), e;
}
remove(t) {
this.requests.delete(t.segment);
@ -2952,7 +2959,7 @@ class Cr {
this.requests.clear();
}
}
class vr {
class Lr {
constructor(t, e) {
f(this, "_status", "pending");
f(this, "_shouldBeStartedImmediately", !1);
@ -2977,7 +2984,7 @@ class vr {
this._shouldBeStartedImmediately = !0;
}
}
function* Ze(s, t, e, n) {
function* Xe(s, t, e, n) {
const { runtimeId: r, stream: i } = s, o = i.segments.get(r);
if (!o) return;
const a = i.segments.values();
@ -3005,7 +3012,7 @@ function Ht(s) {
const { isHighDemand: t = !1, isHttpDownloadable: e = !1, isP2PDownloadable: n = !1 } = s;
return !t && !e && !n;
}
class Lr {
class kr {
constructor(t, e, n, r, i, o, a) {
f(this, "requests");
f(this, "engineRequest");
@ -3036,11 +3043,11 @@ class Lr {
const y = d.size;
for (const w of d.values()) p += w.endTime - w.startTime;
return p / y;
}(h), this.requests = new Cr(this.requestProcessQueueMicrotask, this.bandwidthCalculators, this.playback, this.config, this.eventTarget), !this.segmentStorage.isInitialized) throw new Error("Segment storage is not initialized.");
}(h), this.requests = new vr(this.requestProcessQueueMicrotask, this.bandwidthCalculators, this.playback, this.config, this.eventTarget), !this.segmentStorage.isInitialized) throw new Error("Segment storage is not initialized.");
this.segmentStorage.addIsSegmentLockedPredicate((g) => g.stream === h && function(d, p, y) {
const { isHighDemand: w = !1, isHttpDownloadable: c = !1, isP2PDownloadable: u = !1 } = vt(d, p, y);
return w || c || u;
}(g, this.playback, this.config)), this.p2pLoaders = new _r(this.streamManifestUrl, this.lastRequestedSegment.stream, this.requests, this.segmentStorage, this.config, this.eventTarget, this.requestProcessQueueMicrotask), this.logger = P(`p2pml-core:hybrid-loader-${h.type}`), this.logger.color = "coral", this.setIntervalLoading();
}(g, this.playback, this.config)), this.p2pLoaders = new br(this.streamManifestUrl, this.lastRequestedSegment.stream, this.requests, this.segmentStorage, this.config, this.eventTarget, this.requestProcessQueueMicrotask), this.logger = P(`p2pml-core:hybrid-loader-${h.type}`), this.logger.color = "coral", this.setIntervalLoading();
}
setIntervalLoading() {
const t = this.p2pLoaders.currentLoader.connectedPeerCount, e = 1e3 * Math.random() * t + 1e3;
@ -3052,7 +3059,7 @@ class Lr {
this.logger(`requests: ${Ve(t)}`);
const { stream: n } = t;
n !== this.lastRequestedSegment.stream && (this.logger(`stream changed to ${z(n)}`), this.p2pLoaders.changeCurrentLoader(n)), this.lastRequestedSegment = t;
const r = new vr(t, e);
const r = new Lr(t, e);
if (this.segmentStorage.hasSegment(t)) {
const i = await this.segmentStorage.getSegmentData(t);
if (i) {
@ -3139,7 +3146,7 @@ class Lr {
const { simultaneousHttpDownloads: t, httpErrorRetries: e } = this.config, n = this.p2pLoaders.currentLoader;
if (this.requests.executingHttpCount >= t || !n.connectedPeerCount) return;
const r = [];
for (const { segment: g, statuses: d } of Ze(this.lastRequestedSegment, this.playback, this.config, this.p2pLoaders.currentLoader)) {
for (const { segment: g, statuses: d } of Xe(this.lastRequestedSegment, this.playback, this.config, this.p2pLoaders.currentLoader)) {
if (!d.isHttpDownloadable || d.isP2PDownloadable || this.segmentStorage.hasSegment(g)) continue;
const p = this.requests.get(g);
p && (p.status === "loading" || p.status === "succeed" || (p.failedAttempts.httpAttemptsCount ?? 0) >= e) || r.push(g);
@ -3182,7 +3189,7 @@ class Lr {
var i;
const t = [], e = /* @__PURE__ */ new Set();
let n = 0, r = 0;
for (const o of Ze(this.lastRequestedSegment, this.playback, this.config, this.p2pLoaders.currentLoader)) {
for (const o of Xe(this.lastRequestedSegment, this.playback, this.config, this.p2pLoaders.currentLoader)) {
n++;
const { segment: a } = o;
this.segmentStorage.hasSegment(a) || ((i = this.requests.get(a)) == null ? void 0 : i.status) === "succeed" ? r++ : (t.push(o), e.add(a.runtimeId));
@ -3300,7 +3307,7 @@ class Wn {
function $t(s) {
return `${$(s.stream)}|${s.externalId}`;
}
class kr {
class xr {
constructor(t) {
f(this, "cache", /* @__PURE__ */ new Map());
f(this, "_isInitialized", !1);
@ -3419,7 +3426,7 @@ const j = class j {
this.manifestResponseUrl = t.split("?")[0];
}
hasSegment(t) {
return !!Xe(this.streams, t);
return !!Ze(this.streams, t);
}
getStream(t) {
return this.streams.get(t);
@ -3438,7 +3445,7 @@ const j = class j {
}
async loadSegment(t, e) {
if (!this.manifestResponseUrl) throw new Error("Manifest response url is not defined");
this.segmentStorage || (this.segmentStorage = new kr(this.commonCoreConfig), await this.segmentStorage.initialize());
this.segmentStorage || (this.segmentStorage = new xr(this.commonCoreConfig), await this.segmentStorage.initialize());
const n = this.identifySegment(t);
this.getStreamHybridLoader(n).loadSegment(n, e);
}
@ -3471,7 +3478,7 @@ const j = class j {
}
identifySegment(t) {
if (!this.manifestResponseUrl) throw new Error("Manifest response url is undefined");
const e = Xe(this.streams, t);
const e = Ze(this.streams, t);
if (!e) throw new Error(`Not found segment with id: ${t}`);
return e;
}
@ -3490,16 +3497,16 @@ const j = class j {
if (!this.manifestResponseUrl) throw new Error("Manifest response url is not defined");
if (!((n = this.segmentStorage) != null && n.isInitialized)) throw new Error("Segment storage is not initialized");
const e = t.stream.type === "main" ? this.mainStreamConfig : this.secondaryStreamConfig;
return new Lr(this.manifestResponseUrl, t, this.streamDetails, e, this.bandwidthCalculators, this.segmentStorage, this.eventTarget);
return new kr(this.manifestResponseUrl, t, this.streamDetails, e, this.bandwidthCalculators, this.segmentStorage, this.eventTarget);
}
};
f(j, "DEFAULT_COMMON_CORE_CONFIG", { cachedSegmentExpiration: void 0, cachedSegmentsCount: 0 }), f(j, "DEFAULT_STREAM_CONFIG", { isP2PDisabled: !1, simultaneousHttpDownloads: 2, simultaneousP2PDownloads: 3, highDemandTimeWindow: 15, httpDownloadTimeWindow: 3e3, p2pDownloadTimeWindow: 6e3, webRtcMaxMessageSize: 65535, p2pNotReceivingBytesTimeoutMs: 2e3, p2pInactiveLoaderDestroyTimeoutMs: 3e4, httpNotReceivingBytesTimeoutMs: 3e3, httpErrorRetries: 3, p2pErrorRetries: 3, trackerClientVersionPrefix: ir, announceTrackers: ["wss://tracker.novage.com.ua", "wss://tracker.webtorrent.dev", "wss://tracker.openwebtorrent.com"], rtcConfig: { iceServers: [{ urls: "stun:stun.l.google.com:19302" }, { urls: "stun:global.stun.twilio.com:3478" }] }, validateP2PSegment: void 0, httpRequestSetup: void 0, swarmId: void 0 });
let en = j;
const Ar = on.debug;
const Er = on.debug;
export {
en as Core,
fe as CoreRequestError,
R as RequestError,
Ar as debug
Er as debug
};
//# sourceMappingURL=p2p-media-loader-core.es.min.js.map