decord/beta/source/lib/VideoSpinnerTimer.tsx

87 lines
3.8 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 10893
// Function ID: 10894
// Name: VideoSpinnerTimer
2026-10-12 16:32:48 +00:00
// Dependencies: [502, 2065, 5282, 5110, 5113, 1085, 3, 5121, 1265, 2]
2026-10-12 16:32:48 +00:00
// Module 10893 (VideoSpinnerTimer)
import LoggerDefault from "Logger" /* 3 */;
2026-10-07 22:43:51 +00:00
import Constants from "Constants" /* 1085 */;
2026-10-12 16:32:48 +00:00
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1265 */;
import TimeUtils from "TimeUtils" /* 5121 */;
import AuthenticationStore from "AuthenticationStore" /* 502 */;
2026-10-12 16:32:48 +00:00
import ChannelStore from "ChannelStore" /* 2065 */;
import NetworkStore from "NetworkStore" /* 5282 */;
import RTCConnectionStore from "RTCConnectionStore" /* 5110 */;
import VoiceStateStore from "VoiceStateStore" /* 5113 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-01 14:13:23 +00:00
const AnalyticEvents = Constants.AnalyticEvents;
const map = new Map();
let result = size.fileFinishedImporting("lib/VideoSpinnerTimer.tsx");
class VideoSpinnerTimer {
2026-10-02 13:37:24 +00:00
constructor(_location) {
2026-10-01 14:13:23 +00:00
const merged = Object.assign({ spinnerVisibleStart: null });
2026-10-02 13:37:24 +00:00
merged.logger = new LoggerDefault(_location);
new LoggerDefault(_location);
return merged;
}
2026-10-01 14:13:23 +00:00
onSpinnerStarted() {
if (null == this.spinnerVisibleStart) {
const obj = TimeUtils;
tmp.spinnerVisibleStart = obj.now();
}
2026-10-01 14:13:23 +00:00
}
trackSpinnerDuration(videoSpinnerContext, userId, arg2) {
const self = this;
if (null != this.spinnerVisibleStart) {
let num = map.get(arg2);
const obj3 = map;
if (num == null) {
num = 0;
}
const sum = num + 1;
const result = obj3.set(arg2, sum);
const obj = TimeUtils;
const diff = obj.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";
}
}
}
}
}
2026-10-01 14:13:23 +00:00
const obj2 = { 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() };
const track = AnalyticsUtilsDefault.track;
const VIDEO_SPINNER_SHOWN_V2 = AnalyticEvents.VIDEO_SPINNER_SHOWN_V2;
AnalyticsUtilsDefault;
track(VIDEO_SPINNER_SHOWN_V2, obj2);
}
}
}
2026-10-01 14:13:23 +00:00
}
const prototype = VideoSpinnerTimer.prototype;
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 };