// Module ID: 4536 // Function ID: 4537 // Name: isOwner // Dependencies: [4502, 4516, 4537, 1218, 1391, 4538, 4496, 4539, 4519, 4540, 676, 4509, 687, 4521, 4541, 4329, 4511, 4542, 12, 709, 4543, 4544, 4618, 698, 4439, 4624, 4523, 4625, 4626, 4506, 7348, 2] // Module 4536 (isOwner) import applyDefault from "apply" /* 12 */; import setDefault from "set" /* 687 */; import expandEventPropertiesDefault from "expandEventProperties" /* 698 */; import isStreamKey from "isStreamKey" /* 4511 */; import getEventHistoryStringDefault from "getEventHistoryString" /* 4521 */; import traceEventDefault from "traceEvent" /* 4541 */; import startDefault from "start" /* 4542 */; import removeExecutablePathPrefix from "removeExecutablePathPrefix" /* 4618 */; import getSoundshareAnalyticsContextDefault from "getSoundshareAnalyticsContext" /* 4624 */; import getStreamSourceMetadataDefault from "getStreamSourceMetadata" /* 4625 */; import closure_3 from "_migrateDefaultStorage" /* 4502 */; import { getSystemAnalyticsInfo } from "getSystemAnalyticsInfo" /* 4516 */; import closure_5 from "ApplicationStreamPresets" /* 4537 */; import closure_6 from "fetchFingerprint" /* 1218 */; import closure_7 from "ensureGuildLoaded" /* 1391 */; import closure_8 from "getHookError" /* 4538 */; import closure_9 from "_detectH265HardwareDecode" /* 4496 */; import closure_10 from "handleConnectionInfoChange" /* 4539 */; import closure_11 from "createRTCConnection" /* 4519 */; import closure_12 from "initialize" /* 4540 */; import ME from "ME" /* 676 */; import { MediaEngineContextTypes } from "DesktopSources" /* 4509 */; require = arg1; ({ AnalyticEvents: map1, MediaEngineHookTypes: closure_14, RTCConnectionStates: closure_15 } = ME); let closure_17 = 5 * setDefault.Millis.SECOND; let closure_18 = { DETACHED: 0, [0]: "DETACHED", WAITING: 1, [1]: "WAITING", ATTACHED: 2, [2]: "ATTACHED", STARTED: 3, [3]: "STARTED", PLAYING: 4, [4]: "PLAYING", SILENCE: 5, [5]: "SILENCE" }; getEventHistoryStringDefault; class StreamRTCConnection extends tmp3 { constructor(arg0) { ({ sessionId, streamKey, serverId, initialLayout, channelId } = global); closure_0 = undefined; ({ analyticsContext, parentMediaSessionId } = global); obj = require("isStreamKey"); decodeStreamKeyResult = obj.decodeStreamKey(streamKey); guildId = decodeStreamKeyResult.guildId; obj = { userId: null, sessionId: null, guildId: null, channelId: null, context: null, streamServerId: null, streamChannelId: null, parentMediaSessionId: null, joinVoiceId: null }; id = closure_6.getId(); obj[0] = id; obj[1] = sessionId; obj[2] = guildId; obj[3] = decodeStreamKeyResult.channelId; STREAM = MediaEngineContextTypes.STREAM; obj[4] = STREAM; obj[5] = serverId; obj[6] = channelId; obj[7] = parentMediaSessionId; tmp = new tmp(obj, tmp2, closure_6, id, sessionId, guildId, STREAM, serverId, channelId, new.target, tmp, new.target, closure_0, initialLayout); // ThrowIfThisInitialized (0x7c) closure_0 = tmp; tmp5 = new require("traceEvent")(); tmp.soundshareStats = tmp5; tmp._firstFrameDelivered = false; tmp.screenshareFinishedCount = 0; tmp.soundshareFailuresReported = {}; timeout = new require("start").Timeout(); tmp.errorTimer = timeout; tmp.streamContext = decodeStreamKeyResult; tmp.streamKey = streamKey; tmp7 = new require("start")(initialLayout, tmp.isOwner); tmp.videoStreamStats = tmp7; tmp.analyticsContext = analyticsContext; obj4 = require("apply"); tmp.updateVideoStreamId = obj4.debounce((streamId, rtcServerId) => { ({ guildId, channelId, ownerId } = tmp4(tmp3.streamKey)); const tmp4Result = tmp4(tmp3.streamKey); obj = { type: "RTC_CONNECTION_VIDEO", guildId, channelId, userId: ownerId, streamId, rtcServerId, mediaEngineConnectionId: obj.getMediaEngineConnectionId(), context: closure_1_16.STREAM }; closure_1_1(tmp2[19]).dispatch(obj); return tmp; }, 200); videoStreamStats = tmp.videoStreamStats; startResult = videoStreamStats.start(); initializeEventsResult = tmp.initializeEvents(); return tmp; } destroy(arg0) { videoStreamStats = this.videoStreamStats; stopResult = videoStreamStats.stop(); trackVideoEndStatsResult = this.trackVideoEndStats(global); updateVideoStreamId = this.updateVideoStreamId; cancelResult = updateVideoStreamId.cancel(); updateVideoStreamIdResult = this.updateVideoStreamId(null, null); updateVideoStreamId2 = this.updateVideoStreamId; flushResult = updateVideoStreamId2.flush(); errorTimer = this.errorTimer; stopResult1 = errorTimer.stop(); destroyResult = super.destroy(); return; } } const prototype = StreamRTCConnection.prototype; Object.defineProperty(prototype, "isOwner", { get: function isOwner() { return store.getId() === this.streamContext.ownerId; }, set: undefined }); prototype["streamUpdate"] = function streamUpdate(arg0) { const _videoQuality = this._videoQuality; if (null != _videoQuality) { if (arg0) { _videoQuality.pause(); } else { _videoQuality.resume(); } } }; prototype["layoutChange"] = function layoutChange(arg0) { const videoStreamStats = this.videoStreamStats; videoStreamStats.layoutChange(arg0); }; prototype["autoQualityChange"] = function autoQualityChange() { const videoStreamStats = this.videoStreamStats; videoStreamStats.autoQualityChange(); }; prototype["getVideoStats"] = function getVideoStats() { const _videoQuality = this._videoQuality; if (null != _videoQuality) { if (this.isOwner) { let first = _videoQuality.getOutboundStats()[0]; if (first == null) { first = {}; } let inboundStats = first; } else { inboundStats = _videoQuality.getInboundStats(tmp); if (inboundStats == null) { inboundStats = {}; } } ({ duration: obj3[0], avg_bitrate: obj3[1], avg_fps: obj3[2], avg_resolution: obj3[3], inbound_bitrate_estimate_percentile99: obj3[4] } = inboundStats); return { duration: null, avg_bitrate: null, avg_fps: null, avg_resolution: null, inbound_bitrate_estimate_percentile99: null }; } else { return null; } }; prototype["getRegion"] = function getRegion() { return this.analyticsContext.streamRegion; }; prototype["getMaxViewers"] = function getMaxViewers() { return this.analyticsContext.maxViewers; }; prototype["getVoiceParticipantType"] = function getVoiceParticipantType() { let str = "receiver"; if (this.isOwner) { str = "streamer"; } return str; }; prototype["initializeEvents"] = function initializeEvents() { const self = this; const _require = false; this.on(_require(4543).RTCConnectionEvent.State, (state) => { let obj = self(closure_1_2[19]); obj = { type: "RTC_CONNECTION_STATE", state }; let merged = Object.assign(arg1); let merged1 = Object.assign(arg2); obj.streamKey = self.streamKey; obj.dispatch(obj); if (state === closure_1_15.RTC_CONNECTED) { const _connection8 = tmp4._connection; if (_connection8 != null) { _connection8.on(callback(tmp[21]).BaseConnectionEvent.ScreenshareFinish, (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25) => { closure_0 = arg0; const store = arg1; closure_2 = arg2; closure_3 = arg3; closure_4 = arg4; closure_5 = arg5; closure_6 = arg6; closure_7 = arg7; closure_8 = arg8; closure_9 = arg9; closure_10 = arg10; closure_11 = arg11; closure_12 = arg12; closure_13 = arg13; closure_14 = arg14; closure_15 = arg15; closure_16 = arg16; closure_17 = arg17; closure_18 = arg18; closure_19 = arg19; closure_20 = arg20; closure_21 = arg21; closure_22 = arg22; closure_23 = arg23; closure_24 = arg24; closure_25 = arg25; let analyticsContext = store.analyticsContext; store.screenshareFinishedCount = store.screenshareFinishedCount + 1; const streamApplicationFromHistory = analyticsContext.getStreamApplicationFromHistory(store.screenshareFinishedCount); const runningGameAnalytics = closure_1_0(closure_1_2[22]).getRunningGameAnalytics(streamApplicationFromHistory); ({ gameName: closure_26, gameId: closure_27, exe: closure_28, distributor: closure_29 } = runningGameAnalytics); const mediaSessionId = store.getMediaSessionId(); const rTCConnectionId = store.getRTCConnectionId(); let obj = closure_1_0(closure_1_2[22]); closure_1_4().then((arg0) => { let tmp = null; if (null != arg0) { let obj = { cpu_brand: null, cpu_vendor: null, cpu_memory: null, gpu_brand: null, gpu_memory: null }; ({ cpu_brand: obj[0], cpu_vendor: obj[1], cpu_memory: obj[2], gpu_brand: obj[3], gpu_memory: obj[4] } = arg0); tmp = obj; } obj = { screenshare_frames: closure_0, videohook_frames: closure_1, hybrid_dxgi_frames: closure_2, hybrid_gdi_frames: closure_3, hybrid_videohook_frames: closure_4, hybrid_graphics_capture_frames: closure_5, hybrid_capture_method_switches: closure_6, hybrid_gdi_bitblt_frames: closure_7, hybrid_gdi_printwindow_frames: closure_8, hybrid_graphics_capture_frames_unique: closure_9, hybrid_dxgi_frames_unique: closure_10, hybrid_videohook_frames_unique: closure_11, hybrid_gdi_bitblt_frames_unique: closure_12, hybrid_gdi_printwindow_frames_unique: closure_13, skip_history_json: closure_14, quartz_frames: closure_15, screencapturekit_frames: closure_19, go_live_camera_frames: closure_18, total_frames: null, total_frames_unique: null, desktop_capturer_type: null, media_session_id: null, rtc_connection_id: null, context: null, activity: null, soundshare_session: null, picker_type_used: null, duration: null, share_game_name: null, share_game_id: null, share_game_exe: null, share_game_distributor: null, hdr_frames_capable: null, hdr_frames: null, discord_is_elevated: null, target_window_elevated: null, pipewire_frames: null, x11_frames: null, videohook_backend: null }; let num = closure_0; let num2 = closure_1; let num3 = closure_2; let num4 = closure_3; let num5 = closure_4; let num6 = closure_5; let num7 = closure_9; let num8 = closure_10; let num9 = closure_11; let num10 = closure_12; let num11 = closure_13; let num12 = closure_15; let num13 = closure_19; let num14 = closure_18; if (closure_0 == null) { num = 0; } if (num2 == null) { num2 = 0; } const sum = num + num2; if (num3 == null) { num3 = 0; } const sum1 = sum + num3; if (num4 == null) { num4 = 0; } const sum2 = sum1 + num4; if (num5 == null) { num5 = 0; } const sum3 = sum2 + num5; if (num6 == null) { num6 = 0; } const sum4 = sum3 + num6; if (num12 == null) { num12 = 0; } const sum5 = sum4 + num12; if (num13 == null) { num13 = 0; } const sum6 = sum5 + num13; if (num14 == null) { num14 = 0; } let num15 = closure_24; const sum7 = sum6 + num14; if (closure_24 == null) { num15 = 0; } let num16 = closure_23; const sum8 = sum7 + num15; if (closure_23 == null) { num16 = 0; } obj[18] = sum8 + num16; if (num7 == null) { num7 = 0; } if (num8 == null) { num8 = 0; } const sum9 = num7 + num8; if (num9 == null) { num9 = 0; } const sum10 = sum9 + num9; if (num10 == null) { num10 = 0; } const sum11 = sum10 + num10; if (num11 == null) { num11 = 0; } obj[19] = sum11 + num11; obj[20] = closure_16; obj[21] = closure_30; obj[22] = closure_31; obj[23] = closure_2_16.STREAM; obj[24] = closure_17; const soundshareStats = closure_1.soundshareStats; obj[25] = soundshareStats.getStats().soundshare_last_session; let str = "internal"; if (null != closure_1.analyticsContext.nativePickerStyleUsed) { str = "native"; } obj[26] = str; const analyticsContext = closure_1.analyticsContext; obj[27] = analyticsContext.getDuration(); obj[28] = closure_26; obj[29] = closure_27; obj[30] = closure_28; obj[31] = closure_29; obj[32] = closure_20; obj[33] = closure_21; const obj2 = closure_2_1(closure_2_2[23]); const tmp12 = closure_24; const tmp14 = closure_23; const tmp18 = closure_1; const tmp2 = closure_2_1; const tmp3 = closure_2_2; obj[34] = closure_2_1(closure_2_2[24]).getDiscordIsElevated(); obj[35] = closure_22; obj[36] = tmp14; obj[37] = tmp12; obj[38] = closure_25; const merged = Object.assign(tmp); obj2.track(closure_2_13.SCREENSHARE_FINISHED, obj); }); }); } const _connection = tmp4._connection; if (_connection != null) { _connection.on(callback(tmp[21]).BaseConnectionEvent.SoundshareAttached, () => { const goLiveSource = closure_1_9.getGoLiveSource(); let desktopSource; if (goLiveSource != null) { desktopSource = goLiveSource.desktopSource; } if (null != desktopSource) { let obj = closure_1_1(closure_1_2[23]); let desktopSource1; if (goLiveSource != null) { desktopSource1 = goLiveSource.desktopSource; } obj = {}; const merged = Object.assign(closure_1_1(closure_1_2[25])(desktopSource1)); const merged1 = Object.assign(store.getSoundshareAnalyticsProperties()); obj.track(closure_1_13.SOUNDSHARE_ATTACHED, obj); const tmp6 = closure_1_1(closure_1_2[25]); } }); } const _connection2 = tmp4._connection; if (_connection2 != null) { _connection2.on(callback(tmp[21]).BaseConnectionEvent.SoundshareFailed, (arg0) => { ({ failureCode, failureReason, willRetry } = arg0); const goLiveSource = closure_1_9.getGoLiveSource(); let desktopSource; if (goLiveSource != null) { desktopSource = goLiveSource.desktopSource; } const result = store.reportSoundshareFailure(desktopSource, failureCode, failureReason, willRetry); }); } const _connection3 = tmp4._connection; if (_connection3 != null) { _connection3.on(callback(tmp[21]).BaseConnectionEvent.SoundshareSpeaking, () => { const goLiveSource = closure_1_9.getGoLiveSource(); let desktopSource; if (goLiveSource != null) { desktopSource = goLiveSource.desktopSource; } if (null != desktopSource) { let desktopSource1; const obj3 = closure_1_1(closure_1_2[23]); const tmp13 = closure_1_1; const tmp14 = closure_1_2; if (goLiveSource != null) { desktopSource1 = goLiveSource.desktopSource; } const obj = {}; const merged = Object.assign(closure_1_1(closure_1_2[25])(desktopSource1)); const merged1 = Object.assign(store.getSoundshareAnalyticsProperties()); obj3.track(closure_1_13.SOUNDSHARE_TRANSMITTING, obj); if (null != closure_1_8.getHookError(closure_1_14.SOUND)) { tmp13(tmp14[19]).dispatch({ type: "MEDIA_ENGINE_SOUNDSHARE_TRANSMITTING" }); const tmp13Result = tmp13(tmp14[19]); } const tmp16 = closure_1_1(closure_1_2[25]); } }); } const _connection4 = tmp4._connection; if (_connection4 != null) { _connection4.on(callback(tmp[21]).BaseConnectionEvent.SoundshareTrace, (type) => { const goLiveSource = closure_1_9.getGoLiveSource(); let obj = store; const soundshareStats = store.soundshareStats; let soundshareSession; if (goLiveSource != null) { let desktopSource = goLiveSource.desktopSource; if (desktopSource != null) { soundshareSession = desktopSource.soundshareSession; } } soundshareStats.traceEvent(soundshareSession, type); type = type.type; if ("soundshare_attach_requested" === type) { const errorTimer2 = obj.errorTimer; errorTimer2.start(closure_1_17, () => { callback(table[19]).dispatch({ type: "MEDIA_ENGINE_SOUNDSHARE_FAILED", errorMessage: "Sound Hook Failed" }); }); } else if ("soundshare_recv_failed" === type) { ({ reason, code, retry } = type); desktopSource = undefined; if (goLiveSource != null) { desktopSource = goLiveSource.desktopSource; } if (null != desktopSource) { let desktopSource1; if (goLiveSource != null) { desktopSource1 = goLiveSource.desktopSource; } const result = obj.reportSoundshareFailure(desktopSource1, code, reason, retry); if (!retry) { const errorTimer = obj.errorTimer; errorTimer.stop(); obj = { type: "MEDIA_ENGINE_SOUNDSHARE_FAILED", errorMessage: null, errorCode: null }; obj[1] = reason; obj[2] = code; closure_1_1(closure_1_2[19]).dispatch(obj); const obj2 = closure_1_1(closure_1_2[19]); } } } else if ("soundshare_state_transition" === type) { if (type.newState === closure_1_18.PLAYING) { const errorTimer3 = obj.errorTimer; errorTimer3.stop(); closure_1_1(closure_1_2[19]).dispatch({ type: "MEDIA_ENGINE_SOUNDSHARE_TRANSMITTING" }); const obj4 = closure_1_1(closure_1_2[19]); } } }); } const _connection5 = tmp4._connection; if (_connection5 != null) { _connection5.on(callback(tmp[21]).BaseConnectionEvent.FirstFrameStats, (remoteVideoStreamCreatedTimestamp) => { let obj = store; if (!store._firstFrameDelivered) { obj._firstFrameDelivered = true; const streamAnalyticsProperties = obj.getStreamAnalyticsProperties(); obj = { guild_id: null, channel_id: null, rtc_connection_id: null, media_session_id: null, parent_media_session_id: null, num_viewers: null, time_connected_to_first_frame_delivered: null, time_total_to_first_frame: null, time_remote_user_to_video_stream_created: null, time_video_stream_created_to_video_data_received: null, time_video_data_received_to_video_source_delivered_frame: null, time_remote_user_to_mls_external_sender_updated: null, time_remote_user_to_secure_frame_remote_key_ratchet_set: null, time_remote_user_to_secure_frame_local_key_ratchet_set: null, time_remote_user_to_first_frame_decrypted: null }; ({ guild_id: obj3[0], channel_id: obj3[1], rtc_connection_id: obj3[2], media_session_id: obj3[3], parent_media_session_id: obj3[4] } = streamAnalyticsProperties); obj[5] = obj.analyticsContext.numViewers; obj[6] = obj.getDuration(); const obj2 = closure_1_1(closure_1_2[23]); const obj4 = closure_1_0(closure_1_2[26]); obj[7] = closure_1_0(closure_1_2[26]).now() - obj.getCreatedTime(); let NumberResult = null; if (undefined !== remoteVideoStreamCreatedTimestamp.remoteVideoStreamCreatedTimestamp) { NumberResult = null; if (undefined !== remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp) { const _Number = Number; NumberResult = Number(remoteVideoStreamCreatedTimestamp.remoteVideoStreamCreatedTimestamp - remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp); } } obj[8] = NumberResult; let NumberResult1 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.videoDataReceivedTimestamp) { NumberResult1 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.remoteVideoStreamCreatedTimestamp) { const _Number2 = Number; NumberResult1 = Number(remoteVideoStreamCreatedTimestamp.videoDataReceivedTimestamp - remoteVideoStreamCreatedTimestamp.remoteVideoStreamCreatedTimestamp); } } obj[9] = NumberResult1; let NumberResult2 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.videoSourceDeliveredFrameTimestamp) { NumberResult2 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.videoDataReceivedTimestamp) { const _Number3 = Number; NumberResult2 = Number(remoteVideoStreamCreatedTimestamp.videoSourceDeliveredFrameTimestamp - remoteVideoStreamCreatedTimestamp.videoDataReceivedTimestamp); } } obj[10] = NumberResult2; let NumberResult3 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.updateMLSExternalSenderTimestamp) { NumberResult3 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp) { const _Number4 = Number; NumberResult3 = Number(remoteVideoStreamCreatedTimestamp.updateMLSExternalSenderTimestamp - remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp); } } obj[11] = NumberResult3; let NumberResult4 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.setRemoteSecureFrameKeyRatchetTimestamp) { NumberResult4 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp) { const _Number5 = Number; NumberResult4 = Number(remoteVideoStreamCreatedTimestamp.setRemoteSecureFrameKeyRatchetTimestamp - remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp); } } obj[12] = NumberResult4; let NumberResult5 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.setLocalSecureFrameKeyRatchetTimestamp) { NumberResult5 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp) { const _Number6 = Number; NumberResult5 = Number(remoteVideoStreamCreatedTimestamp.setLocalSecureFrameKeyRatchetTimestamp - remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp); } } obj[13] = NumberResult5; let NumberResult6 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.firstFrameDecryptedTimestamp) { NumberResult6 = null; if (undefined !== remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp) { const _Number7 = Number; NumberResult6 = Number(remoteVideoStreamCreatedTimestamp.firstFrameDecryptedTimestamp - remoteVideoStreamCreatedTimestamp.remoteUserCreatedTimestamp); } } obj[14] = NumberResult6; obj2.track(closure_1_13.RECEIVER_FIRST_FRAME_DELIVERED, obj); const nowResult = closure_1_0(closure_1_2[26]).now(); } }); } const _connection6 = tmp4._connection; if (_connection6 != null) { _connection6.on(callback(tmp[21]).BaseConnectionEvent.FirstFrameEncryptedStats, (videoReceiversSetTimestamp) => { const streamAnalyticsProperties = store.getStreamAnalyticsProperties(); let obj = closure_1_1(closure_1_2[23]); obj = { guild_id: streamAnalyticsProperties.guild_id, channel_id: streamAnalyticsProperties.channel_id, rtc_connection_id: streamAnalyticsProperties.rtc_connection_id, media_session_id: streamAnalyticsProperties.media_session_id, parent_media_session_id: streamAnalyticsProperties.parent_media_session_id, time_local_user_to_video_receivers_set: null, time_local_user_to_mls_external_sender_updated: null, time_local_user_to_secure_frame_remote_key_ratchet_set: null, time_local_user_to_secure_frame_local_key_ratchet_set: null, time_local_user_to_first_frame_encrypted: null }; let NumberResult = null; if (undefined !== videoReceiversSetTimestamp.videoReceiversSetTimestamp) { NumberResult = null; if (undefined !== videoReceiversSetTimestamp.localUserCreatedTimestamp) { const _Number = Number; NumberResult = Number(videoReceiversSetTimestamp.videoReceiversSetTimestamp - videoReceiversSetTimestamp.localUserCreatedTimestamp); } } obj[5] = NumberResult; let NumberResult1 = null; if (undefined !== videoReceiversSetTimestamp.updateMLSExternalSenderTimestamp) { NumberResult1 = null; if (undefined !== videoReceiversSetTimestamp.localUserCreatedTimestamp) { const _Number2 = Number; NumberResult1 = Number(videoReceiversSetTimestamp.updateMLSExternalSenderTimestamp - videoReceiversSetTimestamp.localUserCreatedTimestamp); } } obj[6] = NumberResult1; let NumberResult2 = null; if (undefined !== videoReceiversSetTimestamp.setRemoteSecureFrameKeyRatchetTimestamp) { NumberResult2 = null; if (undefined !== videoReceiversSetTimestamp.localUserCreatedTimestamp) { const _Number3 = Number; NumberResult2 = Number(videoReceiversSetTimestamp.setRemoteSecureFrameKeyRatchetTimestamp - videoReceiversSetTimestamp.localUserCreatedTimestamp); } } obj[7] = NumberResult2; let NumberResult3 = null; if (undefined !== videoReceiversSetTimestamp.setLocalSecureFrameKeyRatchetTimestamp) { NumberResult3 = null; if (undefined !== videoReceiversSetTimestamp.localUserCreatedTimestamp) { const _Number4 = Number; NumberResult3 = Number(videoReceiversSetTimestamp.setLocalSecureFrameKeyRatchetTimestamp - videoReceiversSetTimestamp.localUserCreatedTimestamp); } } obj[8] = NumberResult3; let NumberResult4 = null; if (undefined !== videoReceiversSetTimestamp.firstFrameEncryptedTimestamp) { NumberResult4 = null; if (undefined !== videoReceiversSetTimestamp.localUserCreatedTimestamp) { const _Number5 = Number; NumberResult4 = Number(videoReceiversSetTimestamp.firstFrameEncryptedTimestamp - videoReceiversSetTimestamp.localUserCreatedTimestamp); } } obj[9] = NumberResult4; obj.track(closure_1_13.STREAMER_FIRST_FRAME_ENCRYPTED, obj); }); } const _connection7 = tmp4._connection; if (_connection7 != null) { _connection7.on(callback(tmp[21]).BaseConnectionEvent.Destroy, () => { const errorTimer = store.errorTimer; errorTimer.stop(); }); } } }); this.on(_require(4543).RTCConnectionEvent.Video, (arg0, arg1, arg2, arg3, arg4) => { const decodeStreamKeyResult = callback(closure_1_2[16]).decodeStreamKey(self.streamKey); let tmp2 = decodeStreamKeyResult.guildId === arg0; if (tmp2) { tmp2 = decodeStreamKeyResult.channelId === arg1; } if (tmp2) { tmp2 = decodeStreamKeyResult.ownerId === arg2; } if (tmp2) { if (!tmp6) { obj2.trackVideoStartStats(); callback = true; } obj2.updateVideoStreamId(arg3, arg4); tmp6 = null == obj2.getMediaSessionId() || callback; } }); this.on(_require(4543).RTCConnectionEvent.VideoSourceQualityChanged, (guildId, channelId, senderUserId, maxResolution, maxFrameRate, context) => { let obj = self(709); obj = { type: "MEDIA_ENGINE_VIDEO_SOURCE_QUALITY_CHANGED", guildId, channelId, senderUserId, maxResolution, maxFrameRate, context }; obj.dispatch(obj); }); this.on(_require(4543).RTCConnectionEvent.SecureFramesUpdate, () => { self(709).dispatch({ type: "RTC_CONNECTION_SECURE_FRAMES_UPDATE" }); }); this.on(_require(4543).RTCConnectionEvent.RosterMapUpdate, (userIds) => { let obj = self(709); obj = { type: "RTC_CONNECTION_ROSTER_MAP_UPDATE", userIds }; obj.dispatch(obj); }); }; prototype["reportSoundshareFailure"] = function reportSoundshareFailure(desktopSource, code, failureReason, retry) { let str; if (desktopSource != null) { str = desktopSource.soundshareSession; } if (str == null) { str = ""; } const self = this; if (null == this.soundshareFailuresReported[str]) { const _Set = Set; const set = new Set(); self.soundshareFailuresReported[str] = set; } let tmp6 = null != code; if (tmp6) { let obj = self.soundshareFailuresReported[str]; tmp6 = !obj.has(code); } if (tmp6) { self.soundshareFailuresReported[str].add(code); const obj2 = self.soundshareFailuresReported[str]; } if (tmp8) { obj = { soundshare_failure_code: null, soundshare_failure_reason: null, soundshare_failure_will_retry: null }; obj[0] = code; obj[1] = failureReason; obj[2] = retry; const merged = Object.assign(getSoundshareAnalyticsContextDefault(desktopSource)); const merged1 = Object.assign(self.getSoundshareAnalyticsProperties()); expandEventPropertiesDefault.track(constants.SOUNDSHARE_FAILED, obj); const obj3 = expandEventPropertiesDefault; } }; prototype["getStreamAnalyticsProperties"] = function getStreamAnalyticsProperties() { const self = this; ({ analyticsContext, streamContext } = this); ({ streamRegion, streamApplication, streamSourceType, actionContext } = analyticsContext); ({ ownerId, guildId } = streamContext); region = region.getRegion(hostname.getHostname()); let obj = removeExecutablePathPrefix; const runningGameAnalytics = obj.getRunningGameAnalytics(streamApplication); obj = { channel_id: this.channelId, rtc_connection_id: this.getRTCConnectionId(), media_session_id: this.getMediaSessionId(), parent_media_session_id: this.parentMediaSessionId, sender_user_id: ownerId, context: MediaEngineContextTypes.STREAM, guild_id: guildId, stream_region: streamRegion, stream_source_type: streamSourceType, guild_region: region, participant_type: null, share_application_name: null, share_application_id: null, share_application_executable: null, share_application_distributor: null, share_application_distributor_game_id: null, share_application_game_metadata: null, video_layout: null, client_event_source: null, voice_backend_version: null, rtc_worker_backend_version: null }; ({ gameName, gameId, exe, distributor, sku, gameMetadata } = runningGameAnalytics); let str = "receiver"; if (this.isOwner) { str = "streamer"; } obj[10] = str; obj[11] = gameName; obj[12] = gameId; obj[13] = exe; obj[14] = distributor; obj[15] = sku; obj[16] = gameMetadata; const videoStreamStats = self.videoStreamStats; obj[17] = videoStreamStats.getLayout(); obj[18] = actionContext; ({ voiceVersion: obj2[19], rtcWorkerVersion: obj2[20] } = self); return obj; }; prototype["getSoundshareAnalyticsProperties"] = function getSoundshareAnalyticsProperties() { return { rtc_connection_id: this.getRTCConnectionId(), soundshare_experimental: experimentalSoundshare.getExperimentalSoundshare() }; }; prototype["trackVideoStartStats"] = function trackVideoStartStats() { const self = this; let tmp = null; if (this.isOwner) { tmp = getStreamSourceMetadataDefault(); } let obj = expandEventPropertiesDefault; obj = {}; const merged = Object.assign(self.getStreamAnalyticsProperties()); const merged1 = Object.assign(tmp); obj.connection_type = store2.getType(); obj.effective_connection_speed = store2.getEffectiveConnectionSpeed(); obj.service_provider = store2.getServiceProvider(); obj.duration_go_live_modal = self.analyticsContext.goLiveModalDurationMs; obj.source_location_stack = self.analyticsContext.analyticsLocations; obj.track(constants.VIDEO_STREAM_STARTED, obj); }; prototype["trackVideoEndStats"] = function trackVideoEndStats(arg0) { let self = this; self = this; closure_1 = arg0; const channel = obj.getChannel(this.channelId); let type = null; if (null != channel) { type = channel.type; } let _videoQuality = self._videoQuality; if (null != _videoQuality) { dependencyMap = _videoQuality.getNetworkStats(); const getCodecUsageStats = _videoQuality.getCodecUsageStats; if (self.isOwner) { let codecUsageStats = getCodecUsageStats("streamer", self.userId); } else { codecUsageStats = getCodecUsageStats("receiver", tmp3); } obj = { stream_application_name: null }; obj[0] = obj2(4626).default.getApplicationNames(); if (self.isOwner) { obj = { clips_enabled: null, clips_buffer_length: null }; obj[0] = tmp5(4506).isClipsEnabled(); obj[1] = tmp8.clipsLength; const tmp5Result = tmp5(4506); } else { obj = {}; } if (self.isOwner) { obj1 = { bandwidth_estimation_experiment: null }; obj1[0] = self.getBandwidthEstimationExperiment(); obj2 = obj1; } else { obj2 = {}; } const outboundStats = _videoQuality.getOutboundStats(); const item = outboundStats.forEach((num_frames) => { let num = num_frames.num_frames; if (num == null) { num = 0; } if (num > 0) { obj2 = callback(698); obj = {}; const merged = Object.assign(codecUsageStats); const merged1 = Object.assign(dependencyMap); const merged2 = Object.assign(obj); const videoStreamStats = self.videoStreamStats; const merged3 = Object.assign(videoStreamStats.getStats()); const merged4 = Object.assign(num_frames); const soundshareStats = self.soundshareStats; const merged5 = Object.assign(soundshareStats.getStats()); const merged6 = Object.assign(self.getStreamAnalyticsProperties()); const merged7 = Object.assign(obj); const merged8 = Object.assign(obj2); obj.app_hardware_acceleration_enabled = callback(4439).getAppHardwareAccelerationEnabled(); obj.channel_type = type; obj.reason = callback; obj.max_viewers = self.analyticsContext.maxViewers; obj.hostname = self.hostname; obj.hardware_enabled = closure_1_9.getHardwareEncoding(); let tmp = null; if (self.isOwner) { tmp = tmp4(7348)(); } obj.device_performance_class = tmp; obj.soundshare_experimental = closure_1_9.getExperimentalSoundshare(); obj.quality_preset = _videoQuality.getState().preset; const obj4 = callback(4439); const obj5 = closure_1_9; obj.discord_is_elevated = callback(4439).getDiscordIsElevated(); obj2.track(closure_1_13.VIDEO_STREAM_ENDED, obj); const tmp4Result = callback(4439); } }); _videoQuality = _videoQuality.getInboundParticipants(); const item1 = _videoQuality.forEach((arg0) => { const inboundStats = _videoQuality.getInboundStats(arg0); let num; if (inboundStats != null) { num = inboundStats.num_frames; } if (num == null) { num = 0; } if (num > 0) { obj = callback(698); obj = {}; const merged = Object.assign(codecUsageStats); const merged1 = Object.assign(dependencyMap); const merged2 = Object.assign(obj); const videoStreamStats = self.videoStreamStats; const merged3 = Object.assign(videoStreamStats.getStats()); const merged4 = Object.assign(inboundStats); const soundshareStats = self.soundshareStats; const merged5 = Object.assign(soundshareStats.getStats()); const merged6 = Object.assign(self.getStreamAnalyticsProperties()); const merged7 = Object.assign(obj); const merged8 = Object.assign(obj2); obj.app_hardware_acceleration_enabled = callback(4439).getAppHardwareAccelerationEnabled(); obj.channel_type = type; obj.reason = callback; obj.max_viewers = self.analyticsContext.maxViewers; obj.hostname = self.hostname; obj.hardware_enabled = closure_1_9.getHardwareEncoding(); let tmp2 = null; if (self.isOwner) { tmp2 = tmp4(7348)(); } obj.device_performance_class = tmp2; obj.track(closure_1_13.VIDEO_STREAM_ENDED, obj); const obj3 = callback(4439); tmp4 = callback; } }); const _default = obj2(4626).default; tmp5 = obj2; } }; prototype["getExtraConnectionOptions"] = function getExtraConnectionOptions() { const obj = { streamUserId: isStreamKey.decodeStreamKey(this.streamKey).ownerId }; return obj; }; prototype["getMediaStreamKey"] = function getMediaStreamKey() { return this.streamKey; }; let result = require("set").fileFinishedImporting("modules/go_live/StreamRTCConnection.tsx"); class StreamRTCAnalyticsContext { constructor(arg0) { ({ streamApplication, numViewers, analyticsLocations } = global); ({ streamRegion, streamSourceType, actionContext, goLiveModalDurationMs } = global); obj = Object.create(new.target.prototype); obj.streamRegion = streamRegion; obj.streamApplication = streamApplication; items = []; items[0] = streamApplication; obj.streamApplicationHistory = items; obj.streamSourceType = streamSourceType; obj.actionContext = actionContext; obj.maxViewers = numViewers; obj.goLiveModalDurationMs = goLiveModalDurationMs; obj.numViewers = numViewers; if (analyticsLocations == null) { analyticsLocations = []; } obj.analyticsLocations = analyticsLocations; return obj; } } const prototype2 = StreamRTCAnalyticsContext.prototype; prototype2["setActionContext"] = function setActionContext(appContext) { this.actionContext = appContext; }; prototype2["updateStreamApplication"] = function updateStreamApplication(streamApplication) { this.streamApplication = streamApplication; const items = []; items[HermesBuiltin.arraySpread(this.streamApplicationHistory, 0)] = streamApplication; this.streamApplicationHistory = items; }; prototype2["setAnalyticsLocations"] = function setAnalyticsLocations(analyticsLocations) { this.analyticsLocations = analyticsLocations; }; prototype2["trackViewerCount"] = function trackViewerCount(length) { this.maxViewers = Math.max(length, this.maxViewers); this.numViewers = length; }; prototype2["setNativePickerStyleUsed"] = function setNativePickerStyleUsed(closure_1) { this.nativePickerStyleUsed = closure_1; }; prototype2["trackStart"] = function trackStart() { this.startTime = performance.now(); }; prototype2["trackEnd"] = function trackEnd() { this.endTime = performance.now(); }; prototype2["getStreamApplicationFromHistory"] = function getStreamApplicationFromHistory(screenshareFinishedCount) { return this.streamApplicationHistory[screenshareFinishedCount]; }; prototype2["getDuration"] = function getDuration() { const self = this; if (null == this.startTime) { return null; } else { const _performance = performance; let endTime = self.endTime; if (endTime == null) { endTime = performance.now(); } return endTime - self.startTime; } }; export default StreamRTCConnection; export { StreamRTCAnalyticsContext };