p2p-media-loader-hlsjs
Version:
P2P Media Loader hls.js integration
34 lines • 2.13 kB
JavaScript
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
import { HlsJsP2PEngine, } from "./engine.js";
export function injectMixin(HlsJsClass) {
var _HlsJsWithP2PClass_p2pEngine, _a;
return _a = class HlsJsWithP2PClass extends HlsJsClass {
get p2pEngine() {
return __classPrivateFieldGet(this, _HlsJsWithP2PClass_p2pEngine, "f");
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(...args) {
const config = args[0];
const { p2p, ...hlsJsConfig } = config ?? {};
const p2pEngine = new HlsJsP2PEngine(p2p);
super({ ...hlsJsConfig, ...p2pEngine.getConfigForHlsJs() });
_HlsJsWithP2PClass_p2pEngine.set(this, void 0);
p2pEngine.bindHls(this);
__classPrivateFieldSet(this, _HlsJsWithP2PClass_p2pEngine, p2pEngine, "f");
p2p?.onHlsJsCreated?.(this);
}
},
_HlsJsWithP2PClass_p2pEngine = new WeakMap(),
_a;
}
//# sourceMappingURL=engine-static.js.map