70 lines
1.9 KiB
TypeScript
70 lines
1.9 KiB
TypeScript
// Metro module 14162 (f14163).
|
|
import { Logger } from "../../_bundle/log";
|
|
import { SessionManager } from "./utils/SessionManager";
|
|
import { MuxIntegration } from "./integrations/MuxIntegration";
|
|
import Module14165 from "../../_bundle/Module14165";
|
|
let c9912_3 = new Logger("SimpleMuxWrapper");
|
|
export class SimpleMuxWrapper {
|
|
constructor(a0) {
|
|
const r6 = {
|
|
__proto__: new.target.prototype,
|
|
isMonitoring: false
|
|
};
|
|
r6.config = a0;
|
|
r6.videoElement = a0.videoElement;
|
|
r6.sessionId = SessionManager.generateSessionId();
|
|
r6.hlsInstance = a0.hlsInstance;
|
|
return r6;
|
|
}
|
|
initialize() {
|
|
let debug = this.config.debug;
|
|
if (debug == null) {
|
|
debug = false;
|
|
}
|
|
const r6 = {
|
|
debug,
|
|
disableCookies: true,
|
|
respectDoNotTrack: true,
|
|
data: MuxIntegration.mapDiscordToMuxMetadata(this.config, this.sessionId)
|
|
};
|
|
if (this.hlsInstance != null) {
|
|
r6.hlsjs = this.hlsInstance;
|
|
r6.Hls = this.hlsInstance.constructor;
|
|
}
|
|
try {
|
|
Module14165.monitor(this.videoElement, r6);
|
|
this.isMonitoring = true;
|
|
} catch ($e) {
|
|
c9912_3.error("Error creating Mux monitor", $e);
|
|
this.isMonitoring = false;
|
|
}
|
|
}
|
|
endSession() {
|
|
if (this.isMonitoring) {
|
|
try {
|
|
if (typeof Module14165.destroyMonitor === "function") {
|
|
Module14165.destroyMonitor(this.videoElement);
|
|
}
|
|
this.isMonitoring = false;
|
|
} catch ($e) {
|
|
c9912_3.error("Error ending Mux session", $e);
|
|
}
|
|
}
|
|
}
|
|
destroy() {
|
|
if (this.isMonitoring) {
|
|
try {
|
|
if (typeof Module14165.destroyMonitor === "function") {
|
|
Module14165.destroyMonitor(this.videoElement);
|
|
}
|
|
this.isMonitoring = false;
|
|
} catch ($e) {
|
|
c9912_3.error("Error destroying Mux monitor", $e);
|
|
}
|
|
}
|
|
}
|
|
getSessionId() {
|
|
return this.sessionId;
|
|
}
|
|
}
|