Files
discord-decomp/sources/modules/video-qoe/integrations/MobileCustomMuxIntegration.tsx
T
2026-07-28 01:06:53 +03:00

697 lines
32 KiB
TypeScript

/* Metro module 13612; source: modules/video-qoe/integrations/MobileCustomMuxIntegration.tsx; dependencies: [6, 7, 4, 13608, 13610, 2] */
import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as LoggerModule from '../../../external/discord_common/js/packages/logger/Logger.tsx'; /* Metro dependency 4 */
import * as SessionManagerModule from '../utils/SessionManager.tsx'; /* Metro dependency 13608 */
function _fun103958(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#103958, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:6, offset: 0x0227997c, size: 184 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Logger = (LoggerModule).Logger;
let logger = new Logger('MobileCustomMuxIntegration');
logger = _fun103959();
(FileImportTrackerModule).fileFinishedImporting('modules/video-qoe/integrations/MobileCustomMuxIntegration.tsx');
exports.MobileCustomMuxIntegration = logger;
function _fun103959() { // fn#103959, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:201, offset: 0x02279a34, size: 785 bytes, params: 1, frame: 15
return CreateClass(MobileCustomMuxIntegration, [{key: 'initialize', value: value_103963}, {key: 'updatePlayheadTime',
value: function(a0) {
this.currentPlayheadTime = a0;
}}, {key: 'updateVideoDimensions', value: function(a0, a1) {
this.videoState.player_width = a0;
this.videoState.player_height = a1;
}}, {key: 'updateVideoSourceDimensions', value: function(a0, a1) {
this.videoState.video_source_width = a0;
this.videoState.video_source_height = a1;
}}, {key: 'updateVideoSource', value: function(a0, a1, a2) {
this.videoState.video_source_url = a0;
this.videoState.video_source_mime_type = a1;
var videoState = this.videoState;
var value = undefined;
videoState.video_source_duration = a2 != null ? a2 * 1000 : value;
return value;
}}, {key: 'updatePlayerState', value: function(a0, a1) {
this.videoState.player_is_paused = a0;
if (a1 != null) {
this.videoState.player_is_fullscreen = a1;
}
}}, {key: 'emitPlayerReady', value: value_103969}, {key: 'emitViewInit', value: value_103970},
{key: 'emitLoadStart', value: value_103971}, {key: 'emitLoad', value: value_103972}, {key: 'emitPlay',
value: value_103973}, {key: 'emitPause', value: value_103974}, {key: 'emitPlaying', value: value_103975},
{key: 'emitWaiting', value: value_103976}, {key: 'emitCanPlay', value: function() {
this.emitPlayerReady();
}}, {key: 'emitSeeking', value: value_103978}, {key: 'emitSeeked', value: value_103979}, {key: 'emitEnded',
value: value_103980}, {key: 'emitError', value: value_103981}, {key: 'emitTimeUpdate', value: value_103982},
{key: 'emitRenditionChange', value: value_103983}, {key: 'destroy', value: value_103984}, {key: 'emitViewEnd',
value: value_103985}, {key: 'getSessionId', value: function() {
return this.sessionId;
}}, {key: 'hasPlayStarted', value: function() {
return this.playStarted;
}}, {key: 'mapConfigToMuxData', value: value_103988}, {key: 'getAppVersion', value: function() {
return this.config.appVersion ?? 'unknown';
}}, {key: 'getMuxEnvKey', value: function() {
return '1qd16mdmdjasipqg3irobln4u';
}}, {key: 'getBuildChannel', value: function() {
return this.config.releaseChannel ?? 'stable';
}}]);
function MobileCustomMuxIntegration(a0) { // fn#103960, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:222, offset: 0x02279d45, size: 371 bytes, params: 2, frame: 16
var environment;
const value = environment.__proto__;
env1_3(this, MobileCustomMuxIntegration);
this.isInitialized = false;
this.viewInitEmitted = false;
this.playerReadyEmitted = false;
this.playStarted = false;
this.playingEmitted = false;
this.currentPlayheadTime = 0;
this.currentRendition = null;
this.getPlayheadTime = getPlayheadTime_103961;
this.getStateData = getStateData_103962;
this.config = a0;
const SessionManager = (SessionManagerModule).SessionManager;
this.sessionId = SessionManager.generateSessionId();
this.playerId = 'discord-mobile-' + this.sessionId;
this.videoState = {'player_is_paused': true, 'player_width': 0, 'player_height': 0, 'player_autoplay_on': false,
'player_preload_on': true, 'video_cdn': 'Cloudflare', video_series: a0.contentMetadata.questId,
video_producer: a0.contentMetadata.gameId, video_brand: a0.contentMetadata.gameName,
video_title: a0.contentMetadata.title, video_stream_type: a0.contentMetadata.videoStreamType,
video_source_url: a0.contentMetadata.contentId,
video_source_mime_type: a0.contentMetadata.videoStreamType !== 'hls' ? 'video/mp4' : 'application/x-mpegURL',
video_source_duration: a0.contentMetadata.durationMs};
function MobileCustomMuxIntegrationGetPlayheadTime() { // fn#103961, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:487, owner: MobileCustomMuxIntegration.getPlayheadTime, offset: 0x02279eb8, size: 25 bytes, params: 1, frame: 2
return env0_0.currentPlayheadTime * 1000;
}
function MobileCustomMuxIntegrationGetStateData() { // fn#103962, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:536, owner: MobileCustomMuxIntegration.getStateData, offset: 0x02279ed1, size: 15 bytes, params: 1, frame: 1
return env0_0.videoState;
}
}
function value_103963() { // fn#103963, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:1231, offset: 0x02279ee0, size: 269 bytes, params: 1, frame: 22
var r8;
var binding;
var info;
var value2;
var property;
var defaultImport;
var init;
var playerId;
var object;
var config;
var debug;
var value3;
var getPlayheadTime;
var getStateData;
var error;
let value = this.getMuxEnvKey();
if (value == null) {
value = environment.__proto__;
env1_5.info('Mux environment key not available, skipping QoE tracking');
} else if (value.length !== 0) {
try {
value2 = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
init = defaultImport.init;
playerId = this.playerId;
object = {};
config = this.config;
debug = config.debug;
value3 = debug != null;
r8 = value3 && debug;
object.debug = r8;
getPlayheadTime = this.getPlayheadTime;
object.getPlayheadTime = getPlayheadTime;
getStateData = this.getStateData;
object.getStateData = getStateData;
value = this.mapConfigToMuxData(value);
object.data = value;
Reflect.apply(init, defaultImport, [playerId, object]);
this.isInitialized = true;
binding = env1_5;
info = binding.info;
playerId = this.playerId;
Reflect.apply(info, binding, ['Mux Data mobile integration initialized', {playerId: playerId}]);
} catch (error) {
binding = env1_5;
binding.error('Error initializing Mux mobile integration', error);
this.isInitialized = false;
}
} else {
value = environment.__proto__;
env1_5.info('Mux environment key not available, skipping QoE tracking');
}
}
function value_103969() { // fn#103969, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:2389, offset: 0x0227a0bb, size: 110 bytes, params: 1, frame: 14
var value;
var property;
var defaultImport;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
if (!this.playerReadyEmitted) {
try {
value = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
emit = defaultImport.emit;
playerId = this.playerId;
Reflect.apply(emit, defaultImport, [playerId, 'playerready']);
this.playerReadyEmitted = true;
} catch (error) {
binding = env1_5;
binding.error('Error emitting playerready event', error);
}
}
}
}
function value_103970() { // fn#103970, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:2605, offset: 0x0227a129, size: 110 bytes, params: 1, frame: 14
var value;
var property;
var defaultImport;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
if (!this.viewInitEmitted) {
try {
value = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
emit = defaultImport.emit;
playerId = this.playerId;
Reflect.apply(emit, defaultImport, [playerId, 'viewinit']);
this.viewInitEmitted = true;
} catch (error) {
binding = env1_5;
binding.error('Error emitting viewinit event', error);
}
}
}
}
function value_103971() { // fn#103971, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:2810, offset: 0x0227a197, size: 54 bytes, params: 1, frame: 13
var error;
var value;
var binding;
if (this.isInitialized) {
try {
this.emitViewInit();
} catch (error) {
value = environment.__proto__;
binding = env1_5;
binding.error('Error emitting loadstart/viewinit event', error);
}
}
}
function value_103972(a0) { // fn#103972, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:2954, offset: 0x0227a1cd, size: 65 bytes, params: 2, frame: 14
var error;
var value;
var binding;
if (this.isInitialized) {
try {
this.updateVideoSource(undefined, undefined, a0);
} catch (error) {
value = environment.__proto__;
binding = env1_5;
binding.error('Error emitting load events', error);
}
}
}
function value_103973() { // fn#103973, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:3106, offset: 0x0227a20e, size: 137 bytes, params: 1, frame: 15
var viewInitEmitted;
var value;
var property;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
try {
viewInitEmitted = this.viewInitEmitted;
if (!viewInitEmitted) {
this.emitViewInit();
}
this.updatePlayerState(false);
value = environment.__proto__;
property = dependencyMap[4];
value = importDefault(property);
emit = value.emit;
playerId = this.playerId;
Reflect.apply(emit, value, [playerId, 'play']);
this.playStarted = true;
this.playingEmitted = false;
} catch (error) {
value = environment.__proto__;
binding = env1_5;
binding.error('Error emitting play event', error);
}
}
}
function value_103974() { // fn#103974, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:3364, offset: 0x0227a297, size: 104 bytes, params: 1, frame: 13
var value;
var property;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
try {
this.updatePlayerState(true);
value = environment.__proto__;
property = dependencyMap[4];
value = importDefault(property);
emit = value.emit;
playerId = this.playerId;
Reflect.apply(emit, value, [playerId, 'pause']);
} catch (error) {
value = environment.__proto__;
binding = env1_5;
binding.error('Error emitting pause event', error);
}
}
}
function value_103975() { // fn#103975, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:3541, offset: 0x0227a2ff, size: 197 bytes, params: 1, frame: 14
var viewInitEmitted;
var playStarted;
var value;
var property;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
if (!this.playingEmitted) {
try {
viewInitEmitted = this.viewInitEmitted;
if (!viewInitEmitted) {
this.emitViewInit();
}
playStarted = this.playStarted;
if (!playStarted) {
value = environment.__proto__;
value = importDefault(dependencyMap[4]);
value.emit(this.playerId, 'play');
this.playStarted = true;
}
value = environment.__proto__;
property = dependencyMap[4];
value = importDefault(property);
emit = value.emit;
playerId = this.playerId;
Reflect.apply(emit, value, [playerId, 'playing']);
this.playingEmitted = true;
} catch (error) {
value = environment.__proto__;
binding = env1_5;
binding.error('Error emitting playing event', error);
}
}
}
}
function value_103976() { // fn#103976, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:3857, offset: 0x0227a3c4, size: 93 bytes, params: 1, frame: 13
var value;
var property;
var defaultImport;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
try {
value = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
emit = defaultImport.emit;
playerId = this.playerId;
Reflect.apply(emit, defaultImport, [playerId, 'waiting']);
} catch (error) {
binding = env1_5;
binding.error('Error emitting waiting event', error);
}
}
}
function value_103978() { // fn#103978, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:4072, offset: 0x0227a432, size: 93 bytes, params: 1, frame: 13
var value;
var property;
var defaultImport;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
try {
value = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
emit = defaultImport.emit;
playerId = this.playerId;
Reflect.apply(emit, defaultImport, [playerId, 'seeking']);
} catch (error) {
binding = env1_5;
binding.error('Error emitting seeking event', error);
}
}
}
function value_103979() { // fn#103979, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:4225, offset: 0x0227a48f, size: 93 bytes, params: 1, frame: 13
var value;
var property;
var defaultImport;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
try {
value = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
emit = defaultImport.emit;
playerId = this.playerId;
Reflect.apply(emit, defaultImport, [playerId, 'seeked']);
} catch (error) {
binding = env1_5;
binding.error('Error emitting seeked event', error);
}
}
}
function value_103980() { // fn#103980, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:4375, offset: 0x0227a4ec, size: 101 bytes, params: 1, frame: 14
var value;
var property;
var defaultImport;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
try {
value = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
emit = defaultImport.emit;
playerId = this.playerId;
Reflect.apply(emit, defaultImport, [playerId, 'ended']);
this.emitViewEnd();
} catch (error) {
binding = env1_5;
binding.error('Error emitting ended event', error);
}
}
}
function value_103981(a0) { // fn#103981, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:4542, offset: 0x0227a551, size: 98 bytes, params: 2, frame: 15
var value;
var property;
var defaultImport;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
try {
value = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
emit = defaultImport.emit;
playerId = this.playerId;
Reflect.apply(emit, defaultImport, [playerId, 'error', a0]);
} catch (error) {
binding = env1_5;
binding.error('Error emitting error event', error);
}
}
}
function value_103982() { // fn#103982, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:4698, offset: 0x0227a5b3, size: 154 bytes, params: 1, frame: 16
var r1;
var playStarted;
var playingEmitted;
var value;
var property;
var emit;
var playerId;
var currentPlayheadTime;
var value2;
var error;
var binding;
if (this.isInitialized) {
try {
playStarted = this.playStarted;
if (playStarted) {
playingEmitted = this.playingEmitted;
r1 = !playingEmitted;
} else {
r1 = playStarted;
}
if (r1) {
this.emitPlaying();
}
value = environment.__proto__;
property = dependencyMap[4];
value = importDefault(property);
emit = value.emit;
playerId = this.playerId;
currentPlayheadTime = this.currentPlayheadTime;
value2 = currentPlayheadTime * 1000;
Reflect.apply(emit, value, [playerId, 'timeupdate', {player_playhead_time: value2}]);
} catch (error) {
value = environment.__proto__;
binding = env1_5;
binding.error('Error emitting timeupdate event', error);
}
}
}
function value_103983(a0, a1, a2) { // fn#103983, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:4975, offset: 0x0227a64d, size: 232 bytes, params: 4, frame: 17
var isInitialized;
var currentRendition;
var width;
var height;
var bitrate;
var object;
var updateVideoSourceDimensions;
var value;
var property;
var emit;
var playerId;
var error;
var binding;
var error2;
reduciblePort30: while (true) {
exceptionLanding29: while (true) {
isInitialized = this.isInitialized;
if (isInitialized) {
currentRendition = this.currentRendition;
if (currentRendition != null) {
currentRendition = this.currentRendition;
width = currentRendition.width;
if (width === a0) {
currentRendition = this.currentRendition;
height = currentRendition.height;
if (height === a1) {
currentRendition = this.currentRendition;
bitrate = currentRendition.bitrate;
if (bitrate === a2) {
break reduciblePort30;
}
}
}
}
try {
object = {};
} catch (error) {
break exceptionLanding29;
}
try {
object.width = a0;
} catch (error) {
break exceptionLanding29;
}
try {
object.height = a1;
} catch (error) {
break exceptionLanding29;
}
try {
object.bitrate = a2;
} catch (error) {
break exceptionLanding29;
}
try {
this.currentRendition = object;
} catch (error) {
break exceptionLanding29;
}
try {
updateVideoSourceDimensions = this.updateVideoSourceDimensions;
} catch (error) {
break exceptionLanding29;
}
try {
Reflect.apply(updateVideoSourceDimensions, this, [a0, a1]);
} catch (error) {
break exceptionLanding29;
}
value = environment.__proto__;
try {
} catch (error) {
break exceptionLanding29;
}
try {
} catch (error) {
break exceptionLanding29;
}
try {
property = dependencyMap[4];
} catch (error) {
break exceptionLanding29;
}
try {
value = importDefault(property);
} catch (error) {
break exceptionLanding29;
}
try {
emit = value.emit;
} catch (error) {
break exceptionLanding29;
}
try {
playerId = this.playerId;
} catch (error) {
break exceptionLanding29;
}
try {
object = {};
} catch (error) {
break exceptionLanding29;
}
try {
object.video_source_width = a0;
} catch (error) {
break exceptionLanding29;
}
try {
object.video_source_height = a1;
} catch (error) {
break exceptionLanding29;
}
try {
object.video_source_bitrate = a2;
} catch (error) {
break exceptionLanding29;
}
try {
Reflect.apply(emit, value, [playerId, 'renditionchange', object]);
} catch (error) {
break exceptionLanding29;
}
break reduciblePort30;
}
break reduciblePort30;
}
value = environment.__proto__;
binding = env1_5;
error2 = binding.error;
Reflect.apply(error2, binding, ['Error emitting renditionchange event', error]);
break reduciblePort30;
}
}
function value_103984() { // fn#103984, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:5436, offset: 0x0227a735, size: 147 bytes, params: 1, frame: 15
var value;
var property;
var defaultImport;
var emit;
var playerId;
var binding;
var info;
var error;
if (this.isInitialized) {
try {
this.emitViewEnd();
value = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
emit = defaultImport.emit;
playerId = this.playerId;
Reflect.apply(emit, defaultImport, [playerId, 'destroy']);
this.isInitialized = false;
binding = env1_5;
info = binding.info;
playerId = this.playerId;
Reflect.apply(info, binding, ['Mux Data mobile integration destroyed', {playerId: playerId}]);
} catch (error) {
value = environment.__proto__;
binding = env1_5;
binding.error('Error destroying Mux mobile integration', error);
}
}
}
function value_103985() { // fn#103985, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:5715, offset: 0x0227a7c8, size: 93 bytes, params: 1, frame: 13
var value;
var property;
var defaultImport;
var emit;
var playerId;
var error;
var binding;
if (this.isInitialized) {
try {
value = environment.__proto__;
property = dependencyMap[4];
defaultImport = importDefault(property);
emit = defaultImport.emit;
playerId = this.playerId;
Reflect.apply(emit, defaultImport, [playerId, 'viewend']);
} catch (error) {
binding = env1_5;
binding.error('Error emitting viewend event', error);
}
}
}
}
}
function value_103988(a0) { // fn#103988, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13809:6002, offset: 0x0227a830, size: 305 bytes, params: 2, frame: 12
const object = {'env_key': null, 'session_id': null, 'player_name': 'discord-mobile', 'player_version': '1.0.0',
'player_software_name': 'react-native-video', 'player_software_version': '5.2.1-discord',
'player_mux_plugin_name': 'discord-mobile-custom-integration', 'player_mux_plugin_version': '1.0.0'};
object.env_key = a0;
object.session_id = this.sessionId;
object.video_id = this.config.contentMetadata.contentId;
object.video_title = this.config.contentMetadata.title;
object.video_duration = this.config.contentMetadata.durationMs;
object.video_content_type = this.config.contentMetadata.contentType;
object.video_series = this.config.contentMetadata.questId;
object.video_producer = this.config.contentMetadata.gameId;
object.video_brand = this.config.contentMetadata.gameName ?? 'Discord';
object.video_cdn = 'Cloudflare';
object.video_stream_type = this.config.contentMetadata.videoStreamType;
object.view_client_application_name = this.getBuildChannel();
object.view_client_application_version = this.getAppVersion();
object.experiment_name = this.config.contentMetadata.experimentName;
return object;
}
global.__d(_fun103958, 13612, [6, 7, 4, 13608, 13610,
2]) /* metro module 13612, dependencies: [6, 7, 4, 13608, 13610, 2] */;