decord/alpha/source/modules/media_engine/trackVideoToggle.tsx

58 lines
2.1 KiB
TypeScript
Raw Normal View History

// Module ID: 13576
// Function ID: 13577
2026-07-20 16:05:17 +00:00
// Name: trackVideoToggle
// Dependencies: [1074, 13570, 1241, 2]
2026-07-20 16:05:17 +00:00
// Exports: default, setVideoToggleAnalyticsParams
// Module 13576 (trackVideoToggle)
import Constants from "Constants" /* 1074 */;
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1241 */;
import VideoHealthManager from "VideoHealthManager" /* 13570 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const AnalyticEvents = Constants.AnalyticEvents;
const result = size.fileFinishedImporting("modules/media_engine/trackVideoToggle.tsx");
2026-07-20 16:05:17 +00:00
export default function trackVideoToggle(toggled_user_id, video_toggle_reason, is_video_shown) {
const defaultConfig = VideoHealthManager.VideoHealthManager.defaultConfig;
2026-07-20 16:05:17 +00:00
const featureEnabled = defaultConfig.featureEnabled;
({ windowLength, allowedPoorFpsRatio, fpsThreshold, backoffTimeSec } = defaultConfig);
const obj2 = { video_toggle_reason, toggled_user_id, rtc_connection_id: null, media_session_id: null, video_health_manager_window_length: null, video_health_manager_poor_fps_ratio: null, video_health_manager_fps_threshold: null, is_video_shown: null, video_health_manager_backoff_time_seconds: null };
2026-07-20 16:05:17 +00:00
let tmp;
if (global != null) {
tmp = global();
2026-07-20 16:05:17 +00:00
}
obj2.rtc_connection_id = tmp;
2026-07-29 08:29:29 +00:00
let tmp2;
if (require != null) {
tmp2 = require();
2026-07-20 16:05:17 +00:00
}
obj2.media_session_id = tmp2;
2026-07-29 08:29:29 +00:00
let tmp3 = null;
2026-07-20 16:05:17 +00:00
if (featureEnabled) {
2026-07-29 08:29:29 +00:00
tmp3 = windowLength;
2026-07-20 16:05:17 +00:00
}
obj2.video_health_manager_window_length = tmp3;
2026-07-29 08:29:29 +00:00
let tmp4 = null;
2026-07-20 16:05:17 +00:00
if (featureEnabled) {
2026-07-29 08:29:29 +00:00
tmp4 = allowedPoorFpsRatio;
2026-07-20 16:05:17 +00:00
}
obj2.video_health_manager_poor_fps_ratio = tmp4;
2026-07-29 08:29:29 +00:00
let tmp5 = null;
2026-07-20 16:05:17 +00:00
if (featureEnabled) {
2026-07-29 08:29:29 +00:00
tmp5 = fpsThreshold;
2026-07-20 16:05:17 +00:00
}
obj2.video_health_manager_fps_threshold = tmp5;
obj2.is_video_shown = is_video_shown;
2026-07-29 08:29:29 +00:00
let tmp6 = null;
2026-07-20 16:05:17 +00:00
if (featureEnabled) {
2026-07-29 08:29:29 +00:00
tmp6 = backoffTimeSec;
2026-07-20 16:05:17 +00:00
}
obj2.video_health_manager_backoff_time_seconds = tmp6;
AnalyticsUtilsDefault.track(AnalyticEvents.VIDEO_TOGGLED, obj2);
2026-07-20 16:05:17 +00:00
};
export function setVideoToggleAnalyticsParams(getRTCConnectionId, getMediaSessionId) {
global = getRTCConnectionId;
require = getMediaSessionId;
2026-07-20 16:05:17 +00:00
}