82 lines
2.5 KiB
TypeScript
82 lines
2.5 KiB
TypeScript
// Module ID: 15140
|
|
// Function ID: 15141
|
|
// Name: logger
|
|
// Dependencies: [4, 15141, 15142, 15143, 2]
|
|
|
|
// Module 15140 (logger)
|
|
import set from "set" /* 2 */;
|
|
import log from "log" /* 4 */;
|
|
import generateSessionId from "generateSessionId" /* 15141 */;
|
|
import mapDiscordToMuxMetadata from "mapDiscordToMuxMetadata" /* 15142 */;
|
|
import UDefault from "U" /* 15143 */;
|
|
|
|
const logger = new log.Logger("SimpleMuxWrapper");
|
|
const result = set.fileFinishedImporting("modules/video-qoe/SimpleMuxWrapper.tsx");
|
|
class SimpleMuxWrapper {
|
|
constructor(arg0) {
|
|
obj = Object.create(new.target.prototype);
|
|
obj.config = global;
|
|
obj.videoElement = global.videoElement;
|
|
SessionManager = require("generateSessionId").SessionManager;
|
|
obj.sessionId = SessionManager.generateSessionId();
|
|
obj.hlsInstance = global.hlsInstance;
|
|
return obj;
|
|
}
|
|
}
|
|
const prototype = SimpleMuxWrapper.prototype;
|
|
prototype["initialize"] = function initialize() {
|
|
const self = this;
|
|
let flag = this.config.debug;
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
const obj = { debug: flag, disableCookies: true, respectDoNotTrack: true, data: null };
|
|
const MuxIntegration = mapDiscordToMuxMetadata.MuxIntegration;
|
|
obj[3] = MuxIntegration.mapDiscordToMuxMetadata(self.config, self.sessionId);
|
|
if (null != self.hlsInstance) {
|
|
obj.hlsjs = self.hlsInstance;
|
|
obj.Hls = self.hlsInstance.constructor;
|
|
}
|
|
try {
|
|
UDefault.monitor(self.videoElement, obj);
|
|
self.isMonitoring = true;
|
|
} catch (tmp5) {
|
|
logger.error("Error creating Mux monitor", tmp5);
|
|
tmp.isMonitoring = false;
|
|
}
|
|
};
|
|
prototype["endSession"] = function endSession() {
|
|
const self = this;
|
|
if (this.isMonitoring) {
|
|
try {
|
|
if (typeof UDefault.destroyMonitor === "function") {
|
|
tmp(15143).destroyMonitor(self.videoElement);
|
|
const tmpResult = tmp(15143);
|
|
}
|
|
self.isMonitoring = false;
|
|
tmp = importDefault;
|
|
} catch (tmp3) {
|
|
logger.error("Error ending Mux session", tmp3);
|
|
}
|
|
}
|
|
};
|
|
prototype["destroy"] = function destroy() {
|
|
const self = this;
|
|
if (this.isMonitoring) {
|
|
try {
|
|
if (typeof UDefault.destroyMonitor === "function") {
|
|
tmp(15143).destroyMonitor(self.videoElement);
|
|
const tmpResult = tmp(15143);
|
|
}
|
|
self.isMonitoring = false;
|
|
tmp = importDefault;
|
|
} catch (tmp3) {
|
|
logger.error("Error destroying Mux monitor", tmp3);
|
|
}
|
|
}
|
|
};
|
|
prototype["getSessionId"] = function getSessionId() {
|
|
return this.sessionId;
|
|
};
|
|
|
|
export { SimpleMuxWrapper };
|