decord/source/modules/clips/clipPayloadUtils.tsx

121 lines
4 KiB
TypeScript
Raw Normal View History

// Module ID: 5181
// Function ID: 5182
// Name: clipPayloadUtils
// Dependencies: [32, 5182, 1074, 4630, 5183, 1242, 2]
2026-08-28 06:19:39 +00:00
// Exports: getClipCreatedAt, getClipEventsTimeline, getClipParticipantIds, getClipSyncTimestamp
2026-07-20 16:05:17 +00:00
// Module 5181 (clipPayloadUtils)
import _slicedToArray from "module_32" /* 32 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
const require = fn;
const ClipsConstants = fn(5182);
({ CLIPS_MAX_PARTICIPANTS: closure_4, CLIPS_MAX_TIMELINE_EVENTS: hasOwnProperty, ClipSignalTypes: metroRequire, GameEventType: closure_7, CLIP_RUNTIME: closure_8 } = ClipsConstants);
const AnalyticEvents = fn(1074).AnalyticEvents;
const SpeakingFlags = fn(4630).SpeakingFlags;
const ServerClipGameEventType = { UNKNOWN: 0, [0]: "UNKNOWN", KILL: 1, [1]: "KILL", MULTIKILL: 2, [2]: "MULTIKILL", DEATH: 3, [3]: "DEATH" };
const size = fn(2);
let result = size.fileFinishedImporting("modules/clips/clipPayloadUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getClipCreatedAt = function getClipCreatedAt(createdAt) {
return new Date(createdAt).toISOString();
};
2026-08-28 06:19:39 +00:00
export const getClipSyncTimestamp = function getClipSyncTimestamp(clip) {
if (null != clip.syncTimestamp) {
const editMetadata = clip.editMetadata;
let end;
if (editMetadata != null) {
end = editMetadata.end;
}
if (null != end) {
let length = 1000 * clip.editMetadata.end;
} else {
length = clip.length;
}
const _Date = Date;
const date = new Date(clip.syncTimestamp - (clip.length - length));
return date.toISOString();
}
};
2026-07-20 16:05:17 +00:00
export const getClipParticipantIds = function getClipParticipantIds(users) {
return users.slice(0, React4);
2026-07-20 16:05:17 +00:00
};
export { ServerClipGameEventType };
2026-07-20 16:05:17 +00:00
export const getClipEventsTimeline = function getClipEventsTimeline(clip) {
_require = clip;
2026-07-20 16:05:17 +00:00
const timeline = clip.timeline;
2026-07-29 08:29:29 +00:00
let num;
if (timeline != null) {
num = timeline.length;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
if (0 !== num) {
const decision = clip.decision;
let timestamp;
2026-07-29 08:29:29 +00:00
if (decision != null) {
2026-07-20 16:05:17 +00:00
timestamp = decision.timestamp;
}
if (null != timestamp) {
let editMetadata = clip.editMetadata;
2026-07-29 08:29:29 +00:00
if (editMetadata == null) {
const obj = { start: 0, end: clip.length / 1000 };
2026-07-20 16:05:17 +00:00
editMetadata = obj;
}
const diff = clip.decision.timestamp - clip.length;
2026-07-29 08:29:29 +00:00
const sum = diff + 1000 * editMetadata.end;
const sum1 = diff + 1000 * editMetadata.start;
closure_1 = require("GameEventsOnPlayerExperiment").isGameEventsOnPlayerEnabled("getClipEventsTimeline");
2026-07-20 16:05:17 +00:00
const timeline1 = clip.timeline;
const found = timeline1.filter((signal) => {
2026-08-04 08:36:32 +00:00
editMetadata = editMetadata.editMetadata;
2026-07-20 16:05:17 +00:00
let voiceAudio;
2026-07-29 08:29:29 +00:00
if (editMetadata != null) {
2026-07-20 16:05:17 +00:00
voiceAudio = editMetadata.voiceAudio;
}
let tmp2 = false !== voiceAudio;
if (tmp2) {
tmp2 = signal.signal.type === constants.SPEAKING;
2026-07-20 16:05:17 +00:00
}
if (!tmp2) {
2026-08-04 08:36:32 +00:00
let tmp4 = closure_1;
2026-07-20 16:05:17 +00:00
if (closure_1) {
tmp4 = signal.signal.type === constants.GAME_EVENT;
2026-07-20 16:05:17 +00:00
}
2026-08-04 08:36:32 +00:00
tmp2 = tmp4;
2026-07-20 16:05:17 +00:00
}
return tmp2;
});
const sorted = found.sort((timestamp, timestamp2) => timestamp.timestamp - timestamp2.timestamp);
if (0 !== sorted.length) {
const _Map = Map;
const map = new Map();
const items = [];
const _Map2 = Map;
2026-07-29 08:29:29 +00:00
new Map();
2026-08-04 08:36:32 +00:00
for (const item10061 of sorted) {
let tmp16 = item10061;
if (item10061.signal.type !== constants.SPEAKING) {
2026-07-29 08:29:29 +00:00
continue;
} else {
2026-08-04 08:36:32 +00:00
if (tmp16.timestamp >= sum1) {
2026-07-29 08:29:29 +00:00
obj5.return();
2026-07-20 16:05:17 +00:00
break;
} else {
2026-08-04 08:36:32 +00:00
let result = map.set(tmp16.signal.userId, (tmp16.signal.speakingFlags & SpeakingFlags.VOICE) === SpeakingFlags.VOICE);
2026-07-20 16:05:17 +00:00
}
break;
}
2026-08-04 08:36:32 +00:00
let tmp24 = __exception;
tmp10[Symbol.iterator]().return();
throw tmp24;
2026-07-20 16:05:17 +00:00
}
2026-08-04 08:36:32 +00:00
const tmp10 = map;
2026-07-20 16:05:17 +00:00
}
const obj2 = require("GameEventsOnPlayerExperiment");
2026-07-20 16:05:17 +00:00
}
}
};