83 lines
2.6 KiB
TypeScript
83 lines
2.6 KiB
TypeScript
// Module ID: 15731
|
|
// Function ID: 15732
|
|
// Name: modules/SimpleMuxWrapper
|
|
// Dependencies: [4, 15732, 15733, 15734, 2]
|
|
|
|
// Module 15731 (modules/SimpleMuxWrapper)
|
|
import logger_Logger from "logger/Logger" /* 4 */;
|
|
import SessionManager2 from "SessionManager" /* 15732 */;
|
|
import MuxIntegration2 from "MuxIntegration" /* 15733 */;
|
|
import _modDef15734 from "module_15734" /* 15734 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const logger = new logger_Logger.Logger("SimpleMuxWrapper");
|
|
const result = size.fileFinishedImporting("modules/video-qoe/SimpleMuxWrapper.tsx");
|
|
class SimpleMuxWrapper {
|
|
constructor(config) {
|
|
const merged = Object.assign({ isMonitoring: false });
|
|
merged.config = config;
|
|
merged.videoElement = config.videoElement;
|
|
const SessionManager = SessionManager2.SessionManager;
|
|
merged.sessionId = SessionManager.generateSessionId();
|
|
merged.hlsInstance = config.hlsInstance;
|
|
return merged;
|
|
}
|
|
initialize() {
|
|
let MuxIntegration;
|
|
const self = this;
|
|
let flag = this.config.debug;
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
const obj = { debug: flag, disableCookies: true, respectDoNotTrack: true, data: MuxIntegration.mapDiscordToMuxMetadata(self.config, self.sessionId) };
|
|
MuxIntegration = MuxIntegration2.MuxIntegration;
|
|
if (null != self.hlsInstance) {
|
|
obj.hlsjs = self.hlsInstance;
|
|
obj.Hls = self.hlsInstance.constructor;
|
|
}
|
|
try {
|
|
const obj2 = _modDef15734;
|
|
obj2.monitor(self.videoElement, obj);
|
|
self.isMonitoring = true;
|
|
} catch (tmp4) {
|
|
logger.error("Error creating Mux monitor", tmp4);
|
|
self.isMonitoring = false;
|
|
}
|
|
}
|
|
endSession() {
|
|
const self = this;
|
|
if (this.isMonitoring) {
|
|
try {
|
|
const tmp = importDefault;
|
|
if (typeof _modDef15734.destroyMonitor === "function") {
|
|
const tmpResult = tmp(15734);
|
|
tmpResult.destroyMonitor(self.videoElement);
|
|
}
|
|
self.isMonitoring = false;
|
|
} catch (tmp3) {
|
|
logger.error("Error ending Mux session", tmp3);
|
|
}
|
|
}
|
|
}
|
|
destroy() {
|
|
const self = this;
|
|
if (this.isMonitoring) {
|
|
try {
|
|
const tmp = importDefault;
|
|
if (typeof _modDef15734.destroyMonitor === "function") {
|
|
const tmpResult = tmp(15734);
|
|
tmpResult.destroyMonitor(self.videoElement);
|
|
}
|
|
self.isMonitoring = false;
|
|
} catch (tmp3) {
|
|
logger.error("Error destroying Mux monitor", tmp3);
|
|
}
|
|
}
|
|
}
|
|
getSessionId() {
|
|
return this.sessionId;
|
|
}
|
|
}
|
|
const prototype = SimpleMuxWrapper.prototype;
|
|
|
|
export { SimpleMuxWrapper };
|