Files
discord-decomp/modules/video-qoe/MobileMuxWrapper.tsx
T
2026-11-01 12:12:55 +02:00

198 lines
5.4 KiB
TypeScript

// Metro module 14166 (f14167).
import { Logger } from "../../_bundle/log";
import { MobileCustomMuxIntegration } from "./integrations/MobileCustomMuxIntegration";
let c9942_2 = new Logger("MobileMuxWrapper");
export class MobileMuxWrapper {
constructor(a0) {
const r3 = {
__proto__: new.target.prototype,
muxIntegration: null,
seekingEmitted: false,
seekTimeout: null
};
r3.config = a0;
return r3;
}
initialize() {
try {
this.muxIntegration = new MobileCustomMuxIntegration(this.config);
this.muxIntegration.initialize();
c9942_2.info("MobileMuxWrapper initialized successfully");
} catch ($e) {
c9942_2.error("Error initializing MobileMuxWrapper", $e);
this.muxIntegration = null;
}
}
updatePlayheadTime(a0) {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.updatePlayheadTime(a0);
}
}
updateVideoDimensions(a0, a1) {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.updateVideoDimensions(a0, a1);
}
}
updateVideoSourceDimensions(a0, a1) {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.updateVideoSourceDimensions(a0, a1);
}
}
updateVideoSource(a0, a1, a2) {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.updateVideoSource(a0, a1, a2);
}
}
updatePlayerState(a0, a1) {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.updatePlayerState(a0, a1);
}
}
onLoadStart() {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitLoadStart();
}
}
onLoad(a0) {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitLoad(a0);
}
}
onPlay() {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitPlay();
}
}
onPause() {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitPause();
}
}
onPlaying() {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitPlaying();
}
}
onCanPlay() {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitCanPlay();
}
}
onSeek() {
if (this.muxIntegration != null) {
if (!this.seekingEmitted) {
this.muxIntegration.emitSeeking();
this.seekingEmitted = true;
}
if (this.seekTimeout != null) {
clearTimeout(this.seekTimeout);
}
this.seekTimeout = setTimeout(() => {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitSeeked();
}
this.seekingEmitted = false;
this.seekTimeout = null;
}, 100);
}
}
onEnd() {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitEnded();
}
const muxIntegration2 = this.muxIntegration;
if (muxIntegration2 != null) {
muxIntegration2.destroy();
}
}
onError(a0) {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitError(a0);
}
}
onProgress(a0) {
this.updatePlayheadTime(a0);
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitTimeUpdate();
}
}
onBuffer(a0) {
if (!a0) {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitCanPlay();
}
const muxIntegration2 = this.muxIntegration;
if (muxIntegration2 == null ? void 0 : muxIntegration2.hasPlayStarted()) {
const muxIntegration3 = this.muxIntegration;
if (muxIntegration3 != null) {
muxIntegration3.emitPlaying();
}
}
}
}
onReadyForDisplay() {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitPlayerReady();
}
const muxIntegration2 = this.muxIntegration;
if (muxIntegration2 == null ? void 0 : muxIntegration2.hasPlayStarted()) {
const muxIntegration3 = this.muxIntegration;
if (muxIntegration3 != null) {
muxIntegration3.emitPlaying();
}
}
}
onVideoTrackChange(c20999_0, a1) {
const r8 = a1.find((item) => item.trackId === c20999_0);
if (r8 != null) {
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.emitRenditionChange(r8.width, r8.height, r8.bitrate);
}
}
}
destroy() {
try {
if (this.seekTimeout != null) {
clearTimeout(this.seekTimeout);
this.seekTimeout = null;
}
const muxIntegration = this.muxIntegration;
if (muxIntegration != null) {
muxIntegration.destroy();
}
this.muxIntegration = null;
} catch ($e) {
c9942_2.error("Error destroying MobileMuxWrapper", $e);
}
}
getSessionId() {
const muxIntegration = this.muxIntegration;
let r5 = muxIntegration == null ? void 0 : muxIntegration.getSessionId();
if (r5 == null) {
r5 = null;
}
return r5;
}
isInitialized() {
return this.muxIntegration != null;
}
}