decord/source/modules/media/MediaAnalytics.tsx

39 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 11435
// Function ID: 11436
2026-07-20 16:05:17 +00:00
// Name: logMediaAttachmentPlaybackStarted
2026-07-29 08:29:29 +00:00
// Dependencies: [676, 698, 2]
2026-07-20 16:05:17 +00:00
// Exports: logMediaAttachmentPlaybackEnded, logMediaAttachmentPlaybackStarted
2026-08-25 06:04:03 +00:00
// Module 11435 (logMediaAttachmentPlaybackStarted)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import ME from "ME" /* 676 */;
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
const AnalyticEvents = ME.AnalyticEvents;
const result = set.fileFinishedImporting("modules/media/MediaAnalytics.tsx");
2026-07-20 16:05:17 +00:00
export const logMediaAttachmentPlaybackStarted = function logMediaAttachmentPlaybackStarted(messageChannel, found, totalDurationSecs, messageId, startDurationSecs, id) {
2026-07-29 08:29:29 +00:00
let tmp = totalDurationSecs;
2026-08-24 06:08:38 +00:00
let obj = expandEventPropertiesDefault;
2026-07-29 08:29:29 +00:00
obj = { guild_id: messageChannel.guild_id, channel_id: messageChannel.id, channel_type: messageChannel.type, type: found.content_type, flags: found.flags, size: found.size, duration: totalDurationSecs, message_id: messageId, attachment_id: found.id, start_duration_secs: null, sender_user_id: null };
if (totalDurationSecs == null) {
tmp = startDurationSecs;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[9] = Math.min(tmp, startDurationSecs);
obj[10] = id;
2026-07-20 16:05:17 +00:00
obj.track(AnalyticEvents.MEDIA_ATTACHMENT_PLAYBACK_STARTED, obj);
};
export const logMediaAttachmentPlaybackEnded = function logMediaAttachmentPlaybackEnded(messageId, totalDurationSecs, endDurationSecs, id, durationListeningSecs, found) {
2026-07-29 08:29:29 +00:00
let tmp = totalDurationSecs;
2026-08-24 06:08:38 +00:00
let obj = expandEventPropertiesDefault;
2026-07-29 08:29:29 +00:00
obj = { message_id: messageId, total_duration_secs: totalDurationSecs, end_duration_secs: null, sender_user_id: null, duration_listening_secs: null, type: null };
if (totalDurationSecs == null) {
tmp = endDurationSecs;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = Math.min(tmp, endDurationSecs);
obj[3] = id;
obj[4] = durationListeningSecs;
obj[5] = found.content_type;
2026-07-20 16:05:17 +00:00
obj.track(AnalyticEvents.MEDIA_ATTACHMENT_PLAYBACK_ENDED, obj);
};