1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

p2p-media-loader-hlsjs & p2p-media-loader-core v2.1.0 -> v2.2.0

This commit is contained in:
nobody
2025-02-15 07:34:55 +01:00
parent 9458dfd6c6
commit f1e27bfc90
6 changed files with 3501 additions and 3325 deletions

View File

@@ -1741,9 +1741,9 @@ https://cdn.jsdelivr.net/npm/ngx-bootstrap@19.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@2.1.0/dist/p2p-media-loader-core.es.min.js
https://cdn.jsdelivr.net/npm/p2p-media-loader-core@2.2.0/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@2.1.0/dist/p2p-media-loader-hlsjs.es.min.js
https://cdn.jsdelivr.net/npm/p2p-media-loader-hlsjs@2.2.0/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

@@ -372,7 +372,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 '2.1.0';
return '2.2.0';
}
if (type.startsWith('/p5.js/0.')) return '0.10.2';
if (type.startsWith('/p5.js/1.')) return '1.11.2';

View File

@@ -25,9 +25,9 @@
<h2>New in LocalCDN:</h2>
</div>
<div class="release-notes-area">
<p></p>
<p>Updated</p>
<ul>
<li></li>
<li>p2p-media-loader-hlsjs & p2p-media-loader-core v2.1.0 -> v2.2.0</li>
</ul>
</div>
<div id="generator-section">

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@ var R = (n) => {
throw TypeError(n);
};
var q = (n, t, e) => t in n ? j(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
var r = (n, t, e) => q(n, typeof t != "symbol" ? t + "" : t, e), D = (n, t, e) => t.has(n) || R("Cannot " + e);
var i = (n, t, e) => (D(n, t, "read from private field"), e ? e.call(n) : t.get(n)), l = (n, t, e) => t.has(n) ? R("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), u = (n, t, e, s) => (D(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), x = (n, t, e) => (D(n, t, "access private method"), e);
var a = (n, t, e) => q(n, typeof t != "symbol" ? t + "" : t, e), k = (n, t, e) => t.has(n) || R("Cannot " + e);
var i = (n, t, e) => (k(n, t, "read from private field"), e ? e.call(n) : t.get(n)), l = (n, t, e) => t.has(n) ? R("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), u = (n, t, e, s) => (k(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), x = (n, t, e) => (k(n, t, "access private method"), e);
import { CoreRequestError as T, debug as N, Core as z } from "p2p-media-loader-core";
function F(n, t) {
return t ? `${n}|${t.start}-${t.end}` : n;
@@ -12,154 +12,154 @@ function F(n, t) {
function J(n, t) {
if (n !== void 0 && t !== void 0 && n <= t) return { start: n, end: t };
}
var H, M, g, y, p, m, b, G, A;
var H, M, g, m, p, v, L, $, A;
class B {
constructor(t, e) {
l(this, b);
r(this, "context");
r(this, "config");
r(this, "stats");
l(this, L);
a(this, "context");
a(this, "config");
a(this, "stats");
l(this, H);
l(this, M);
l(this, g);
l(this, y);
l(this, p);
l(this, m);
u(this, y, e), u(this, M, () => new t.loader(t)), this.stats = { aborted: !1, chunkCount: 0, loading: { start: 0, first: 0, end: 0 }, buffering: { start: 0, first: 0, end: 0 }, parsing: { start: 0, end: 0 }, total: 1, loaded: 1, bwEstimate: 0, retry: 0 };
l(this, p);
l(this, v);
u(this, m, e), u(this, M, () => new t.loader(t)), this.stats = { aborted: !1, chunkCount: 0, loading: { start: 0, first: 0, end: 0 }, buffering: { start: 0, first: 0, end: 0 }, parsing: { start: 0, end: 0 }, total: 1, loaded: 1, bwEstimate: 0, retry: 0 };
}
load(t, e, s) {
this.context = t, this.config = e, u(this, H, s);
const { stats: o } = this, { rangeStart: d, rangeEnd: a } = t, E = J(d, a !== void 0 ? a - 1 : void 0);
u(this, m, F(t.url, E));
const h = i(this, y).isSegmentLoadable(i(this, m));
if (!i(this, y).hasSegment(i(this, m)) || !h) return u(this, g, i(this, M).call(this)), i(this, g).stats = this.stats, void i(this, g).load(t, e, s);
i(this, y).loadSegment(i(this, m), { onSuccess: (f) => {
const { stats: r } = this, { rangeStart: d, rangeEnd: o } = t, E = J(d, o !== void 0 ? o - 1 : void 0);
u(this, v, F(t.url, E));
const h = i(this, m).isSegmentLoadable(i(this, v));
if (!i(this, m).hasSegment(i(this, v)) || !h) return u(this, g, i(this, M).call(this)), i(this, g).stats = this.stats, void i(this, g).load(t, e, s);
i(this, m).loadSegment(i(this, v), { onSuccess: (f) => {
u(this, p, f);
const c = i(this, p).data.byteLength;
o.loading = function(L, C, I) {
const w = 8e3 * C / L, S = I - w;
return { start: S - 10, first: S, end: I };
}(i(this, p).bandwidth, c, performance.now()), o.total = c, o.loaded = c, s.onProgress && s.onProgress(this.stats, t, i(this, p).data, void 0), s.onSuccess({ data: i(this, p).data, url: t.url }, this.stats, t, void 0);
r.loading = function(b, C, S) {
const D = 8e3 * C / b, I = S - D;
return { start: I - 10, first: I, end: S };
}(i(this, p).bandwidth, c, performance.now()), r.total = c, r.loaded = c, s.onProgress && s.onProgress(this.stats, t, i(this, p).data, void 0), s.onSuccess({ data: i(this, p).data, url: t.url }, this.stats, t, void 0);
}, onError: (f) => {
f instanceof T && f.type === "aborted" && this.stats.aborted || x(this, b, G).call(this, f);
f instanceof T && f.type === "aborted" && this.stats.aborted || x(this, L, $).call(this, f);
} });
}
abort() {
var t, e;
i(this, g) ? i(this, g).abort() : (x(this, b, A).call(this), (e = (t = i(this, H)) == null ? void 0 : t.onAbort) == null || e.call(t, this.stats, this.context, {}));
i(this, g) ? i(this, g).abort() : (x(this, L, A).call(this), (e = (t = i(this, H)) == null ? void 0 : t.onAbort) == null || e.call(t, this.stats, this.context, {}));
}
destroy() {
i(this, g) ? i(this, g).destroy() : (this.stats.aborted || x(this, b, A).call(this), u(this, H, null), this.config = null);
i(this, g) ? i(this, g).destroy() : (this.stats.aborted || x(this, L, A).call(this), u(this, H, null), this.config = null);
}
}
H = new WeakMap(), M = new WeakMap(), g = new WeakMap(), y = new WeakMap(), p = new WeakMap(), m = new WeakMap(), b = new WeakSet(), G = function(t) {
H = new WeakMap(), M = new WeakMap(), g = new WeakMap(), m = new WeakMap(), p = new WeakMap(), v = new WeakMap(), L = new WeakSet(), $ = function(t) {
var s;
const e = { code: 0, text: "" };
(t instanceof T && t.type === "failed" || t instanceof Error) && (e.text = t.message), (s = i(this, H)) == null || s.onError(e, this.context, null, this.stats);
}, A = function() {
!i(this, p) && i(this, m) && (this.stats.aborted = !0, i(this, y).abortSegmentLoading(i(this, m)));
!i(this, p) && i(this, v) && (this.stats.aborted = !0, i(this, m).abortSegmentLoading(i(this, v)));
};
var v;
var y;
class X {
constructor(t) {
l(this, v);
r(this, "context");
r(this, "stats");
u(this, v, new t.loader(t)), this.stats = i(this, v).stats, this.context = i(this, v).context;
l(this, y);
a(this, "context");
a(this, "stats");
u(this, y, new t.loader(t)), this.stats = i(this, y).stats, this.context = i(this, y).context;
}
load(t, e, s) {
i(this, v).load(t, e, s);
i(this, y).load(t, e, s);
}
abort() {
i(this, v).abort();
i(this, y).abort();
}
destroy() {
i(this, v).destroy();
i(this, y).destroy();
}
}
v = new WeakMap();
y = new WeakMap();
class K {
constructor(t) {
r(this, "core");
a(this, "core");
this.core = t;
}
processMainManifest(t) {
const { levels: e, audioTracks: s } = t;
for (const [o, d] of e.entries()) {
const { url: a } = d;
this.core.addStreamIfNoneExists({ runtimeId: Array.isArray(a) ? a[0] : a, type: "main", index: o });
for (const [r, d] of e.entries()) {
const { url: o } = d;
this.core.addStreamIfNoneExists({ runtimeId: Array.isArray(o) ? o[0] : o, type: "main", index: r });
}
for (const [o, d] of s.entries()) {
const { url: a } = d;
this.core.addStreamIfNoneExists({ runtimeId: Array.isArray(a) ? a[0] : a, type: "secondary", index: o });
for (const [r, d] of s.entries()) {
const { url: o } = d;
this.core.addStreamIfNoneExists({ runtimeId: Array.isArray(o) ? o[0] : o, type: "secondary", index: r });
}
}
updatePlaylist(t) {
const { details: { url: e, fragments: s, live: o } } = t, d = this.core.getStream(e);
const { details: { url: e, fragments: s, live: r } } = t, d = this.core.getStream(e);
if (!d) return;
const a = new Set(d.segments.keys()), E = [];
const o = new Set(d.segments.keys()), E = [];
s.forEach((h, f) => {
const { url: c, byteRange: L, sn: C, start: I, end: w } = h;
const { url: c, byteRange: b, sn: C, start: S, end: D } = h;
if (C === "initSegment") return;
const [S, P] = L, U = J(S, P !== void 0 ? P - 1 : void 0), k = F(c, U);
a.delete(k), d.segments.has(k) || E.push({ runtimeId: k, url: c, externalId: o ? C : f, byteRange: U, startTime: I, endTime: w });
}), (E.length || a.size) && this.core.updateStream(e, E, a.values());
const [I, w] = b, U = J(I, w !== void 0 ? w - 1 : void 0), P = F(c, U);
o.delete(P), d.segments.has(P) || E.push({ runtimeId: P, url: c, externalId: r ? C : f, byteRange: U, startTime: S, endTime: D });
}), (E.length || o.size) && this.core.updateStream(e, E, o.values());
}
}
class $ {
class G {
constructor(t) {
r(this, "core");
r(this, "segmentManager");
r(this, "hlsInstanceGetter");
r(this, "currentHlsInstance");
r(this, "debug", N("p2pml-hlsjs:engine"));
r(this, "updateMediaElementEventHandlers", (t) => {
var o;
const e = (o = this.currentHlsInstance) == null ? void 0 : o.media;
a(this, "core");
a(this, "segmentManager");
a(this, "hlsInstanceGetter");
a(this, "currentHlsInstance");
a(this, "debug", N("p2pml-hlsjs:engine"));
a(this, "updateMediaElementEventHandlers", (t) => {
var r;
const e = (r = this.currentHlsInstance) == null ? void 0 : r.media;
if (!e) return;
const s = t === "register" ? "addEventListener" : "removeEventListener";
e[s]("timeupdate", this.handlePlaybackUpdate), e[s]("seeking", this.handlePlaybackUpdate), e[s]("ratechange", this.handlePlaybackUpdate);
});
r(this, "handleManifestLoaded", (t, e) => {
a(this, "handleManifestLoaded", (t, e) => {
const s = e.networkDetails;
s instanceof XMLHttpRequest ? this.core.setManifestResponseUrl(s.responseURL) : s instanceof Response && this.core.setManifestResponseUrl(s.url), this.segmentManager.processMainManifest(e);
});
r(this, "handleLevelSwitching", (t, e) => {
a(this, "handleLevelSwitching", (t, e) => {
e.bitrate && this.core.setActiveLevelBitrate(e.bitrate);
});
r(this, "handleLevelUpdated", (t, e) => {
this.currentHlsInstance && this.currentHlsInstance.config.liveSyncDurationCount !== e.details.fragments.length - 1 && e.details.live && e.details.fragments[0].type === "main" && !this.currentHlsInstance.userConfig.liveSyncDuration && !this.currentHlsInstance.userConfig.liveSyncDurationCount && e.details.fragments.length > 4 && (this.debug("set liveSyncDurationCount " + (e.details.fragments.length - 1)), this.currentHlsInstance.config.liveSyncDurationCount = e.details.fragments.length - 1), this.core.setIsLive(e.details.live), this.segmentManager.updatePlaylist(e);
a(this, "handleLevelUpdated", (t, e) => {
this.currentHlsInstance && e.details.live && e.details.fragments[0].type === "main" && !this.currentHlsInstance.userConfig.liveSyncDuration && !this.currentHlsInstance.userConfig.liveSyncDurationCount && e.details.fragments.length > 4 && this.updateLiveSyncDurationCount(e), this.core.setIsLive(e.details.live), this.segmentManager.updatePlaylist(e);
});
r(this, "handleMediaAttached", () => {
a(this, "handleMediaAttached", () => {
this.updateMediaElementEventHandlers("register");
});
r(this, "handleMediaDetached", () => {
a(this, "handleMediaDetached", () => {
this.updateMediaElementEventHandlers("unregister");
});
r(this, "handlePlaybackUpdate", (t) => {
a(this, "handlePlaybackUpdate", (t) => {
const e = t.target;
this.core.updatePlayback(e.currentTime, e.playbackRate);
});
r(this, "destroyCore", () => this.core.destroy());
r(this, "destroy", () => {
a(this, "destroyCore", () => this.core.destroy());
a(this, "destroy", () => {
this.destroyCore(), this.updateHlsEventsHandlers("unregister"), this.updateMediaElementEventHandlers("unregister"), this.currentHlsInstance = void 0;
});
this.core = new z(t == null ? void 0 : t.core), this.segmentManager = new K(this.core);
}
static injectMixin(t) {
var s, o;
return e = t, o = class extends e {
constructor(...a) {
var L;
const E = a[0], { p2p: h, ...f } = E ?? {}, c = new $(h);
var s, r;
return e = t, r = class extends e {
constructor(...o) {
var b;
const E = o[0], { p2p: h, ...f } = E ?? {}, c = new G(h);
super({ ...f, ...c.getConfigForHlsJs() });
l(this, s);
c.bindHls(this), u(this, s, c), (L = h == null ? void 0 : h.onHlsJsCreated) == null || L.call(h, this);
c.bindHls(this), u(this, s, c), (b = h == null ? void 0 : h.onHlsJsCreated) == null || b.call(h, this);
}
get p2pEngine() {
return i(this, s);
}
}, s = new WeakMap(), o;
}, s = new WeakMap(), r;
var e;
}
addEventListener(t, e) {
@@ -191,6 +191,10 @@ class $ {
const s = t === "register" ? "on" : "off";
e[s]("hlsManifestLoaded", this.handleManifestLoaded), e[s]("hlsLevelSwitching", this.handleLevelSwitching), e[s]("hlsLevelUpdated", this.handleLevelUpdated), e[s]("hlsAudioTrackLoaded", this.handleLevelUpdated), e[s]("hlsDestroying", this.destroy), e[s]("hlsMediaAttaching", this.destroyCore), e[s]("hlsManifestLoading", this.destroyCore), e[s]("hlsMediaDetached", this.handleMediaDetached), e[s]("hlsMediaAttached", this.handleMediaAttached);
}
updateLiveSyncDurationCount(t) {
const e = t.details.targetduration, s = Math.floor(120 / e), r = Math.min(t.details.fragments.length - 1, s);
this.currentHlsInstance && this.currentHlsInstance.config.liveSyncDurationCount !== r && (this.debug(`Setting liveSyncDurationCount to ${r}`), this.currentHlsInstance.config.liveSyncDurationCount = r);
}
createFragmentLoaderClass() {
const { core: t } = this, e = this;
return class extends B {
@@ -212,6 +216,6 @@ class $ {
}
}
export {
$ as HlsJsP2PEngine
G as HlsJsP2PEngine
};
//# sourceMappingURL=p2p-media-loader-hlsjs.es.min.js.map