decord/alpha/source/lib/VideoSpinnerTimer.tsx
github-actions 72019a2d0c chore: update source for alpha 348.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
2026-09-25 08:38:05 +00:00

80 lines
3.5 KiB
TypeScript

// Module ID: 8875
// Function ID: 8876
// Name: VideoSpinnerTimer
// Dependencies: [502, 2044, 4878, 4852, 4848, 1074, 3, 4858, 1241, 2]
// Module 8875 (VideoSpinnerTimer)
import LoggerDefault from "Logger" /* 3 */;
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1241 */;
import TimeUtils from "TimeUtils" /* 4858 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import ChannelStore from "ChannelStore" /* 2044 */;
import NetworkStore from "NetworkStore" /* 4878 */;
import RTCConnectionStore from "RTCConnectionStore" /* 4852 */;
import VoiceStateStore from "VoiceStateStore" /* 4848 */;
require = fn;
const AnalyticEvents = fn(1074).AnalyticEvents;
const map = new Map();
const size = fn(2);
let result = size.fileFinishedImporting("lib/VideoSpinnerTimer.tsx");
class VideoSpinnerTimer {
constructor(arg0) {
merged = Object.assign({ spinnerVisibleStart: null });
tmp2 = new closure_1(closure_2[6])(global);
merged.logger = tmp2;
return merged;
}
}
const prototype = VideoSpinnerTimer.prototype;
prototype["onSpinnerStarted"] = function onSpinnerStarted() {
if (null == this.spinnerVisibleStart) {
tmp.spinnerVisibleStart = TimeUtils.now();
}
};
prototype["trackSpinnerDuration"] = function trackSpinnerDuration(videoSpinnerContext, userId, arg2) {
const self = this;
if (null != this.spinnerVisibleStart) {
let num = map.get(arg2);
if (num == null) {
num = 0;
}
const sum = num + 1;
const result = map.set(arg2, sum);
const diff = TimeUtils.now() - self.spinnerVisibleStart;
self.spinnerVisibleStart = null;
if (diff < 0) {
const logger = self.logger;
const _HermesInternal = HermesInternal;
logger.warn("spinner duration is negative: " + diff + " ms\n [" + videoSpinnerContext + ", count for stream: " + sum + "]");
} else {
const logger2 = self.logger;
const _HermesInternal2 = HermesInternal;
logger2.info("spinner visible for " + diff + " ms\n [" + videoSpinnerContext + ", count for stream: " + sum + "]");
const guildId = RTCConnectionStore.getGuildId();
const userVoiceChannelId = VoiceStateStore.getUserVoiceChannelId(guildId, AuthenticationStore.getId());
const channel = ChannelStore.getChannel(userVoiceChannelId);
let str = null;
if (null != channel) {
str = "guild_voice";
if (!channel.isGuildVoice()) {
str = "is_stage_channel";
if (!channel.isGuildStageVoice()) {
str = "dm";
if (!channel.isDM()) {
str = null;
if (channel.isGroupDM()) {
str = "group_dm";
}
}
}
}
}
const obj3 = { video_spinner_context: videoSpinnerContext, duration_video_spinner_visible_ms: diff, rtc_connection_id: RTCConnectionStore.getRTCConnectionId(), media_session_id: RTCConnectionStore.getMediaSessionId(), event_count_for_stream: sum, guild_id: guildId, channel_id: userVoiceChannelId, channel_type: str, spinning_user_id: userId, connection_type: NetworkStore.getType(), effective_connection_speed: NetworkStore.getEffectiveConnectionSpeed(), service_provider: NetworkStore.getServiceProvider() };
AnalyticsUtilsDefault.track(AnalyticEvents.VIDEO_SPINNER_SHOWN_V2, obj3);
}
}
};
export const VideoSpinnerContext = { SELF_VIDEO: "self_video", SELF_STREAM: "self_stream", REMOTE_VIDEO: "remote_video", REMOTE_STREAM: "remote_stream", CHANGE_VIDEO_BACKGROUND: "change_video_background", REPLAY_VIDEO_STREAM: "replay_video_stream" };
export { VideoSpinnerTimer };