295 lines
13 KiB
TypeScript
295 lines
13 KiB
TypeScript
/* Metro module 13604; source: modules/video_player/useVideoSegmentAnalytics.tsx; dependencies: [57, 31, 7096, 2] */
|
|
function _fun103421(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#103421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:6, offset: 0x02267dfe, size: 193 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const value = require(31) /* metro dependency 31 */;
|
|
const env0_4 = value.useRef;
|
|
const env0_5 = value.useCallback;
|
|
const env0_6 = value.useEffect;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/video_player/useVideoSegmentAnalytics.tsx');
|
|
exports.default = useVideoSegmentAnalytics;
|
|
exports.SEGMENT_ANALYTICS_EMIT_INTERVAL_MS = 4000;
|
|
exports.SEGMENT_ANALYTICS_MIN_DURATION_MS = 2000;
|
|
}
|
|
|
|
function useVideoSegmentAnalytics({getCurrentVideoTime, onAnalytics, emitIntervalMs, minSegmentDurationMs}) { // fn#103422, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:260, offset: 0x02267ebf, size: 563 bytes, params: 2, frame: 28
|
|
var object2;
|
|
const env0_2 = emitIntervalMs;
|
|
const binding = minSegmentDurationMs;
|
|
let useState = binding.useState;
|
|
const value2 = Reflect.apply(useState, binding, [null]);
|
|
const binding2 = env0_2;
|
|
const value3 = binding2(value2, 2);
|
|
const property = value3[0];
|
|
const env0_5 = value3[1];
|
|
useState = binding.useState;
|
|
const value4 = binding2(Reflect.apply(useState, binding, [false]), 2);
|
|
const property2 = value4[0];
|
|
const env0_7 = value4[1];
|
|
useState = binding.useState;
|
|
const value5 = binding2(Reflect.apply(useState, binding, [false]), 2);
|
|
const property3 = value5[0];
|
|
const env0_9 = value5[1];
|
|
useState = binding.useState;
|
|
const value6 = binding2(Reflect.apply(useState, binding, [false]), 2);
|
|
const property4 = value6[0];
|
|
const env0_11 = value6[1];
|
|
const env0_12 = useRef(null);
|
|
const Date = global.Date;
|
|
const env0_13 = useRef(Date.now());
|
|
const env0_14 = useRef(false);
|
|
const value7 = useCallback(_fun103423, [onAnalytics]);
|
|
const value8 = useCallback(_fun103424, [getCurrentVideoTime, property3, property4]);
|
|
const value9 = useCallback(_fun103425, [property, value7, emitIntervalMs, minSegmentDurationMs,
|
|
getCurrentVideoTime]);
|
|
useEffect(_fun103426, [property3, property4]);
|
|
useEffect(_fun103427, [property2, property3, property4, property, value9, value7, value8, getCurrentVideoTime]);
|
|
const value = useCallback(_fun103430, [property, value7, getCurrentVideoTime]);
|
|
useRef(value).current = value;
|
|
object2 = {};
|
|
object2.handlePlayerStateChange = useCallback(_fun103431, []);
|
|
object2.handleLoadEnd = useCallback(_fun103432, []);
|
|
object2.handleFirstFrame = useCallback(_fun103433, []);
|
|
object2.handleSeek = useCallback(_fun103434, []);
|
|
return object2;
|
|
}
|
|
|
|
function _fun103423(a0) { // fn#103423, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:578, offset: 0x022680f2, size: 128 bytes, params: 2, frame: 13
|
|
var onAnalyticsBinding;
|
|
var object2;
|
|
var startTimeMs;
|
|
var endTimeMs;
|
|
let segmentEndSec = a0.segmentEndSec;
|
|
let segmentStartSec = a0.segmentStartSec;
|
|
if (!(segmentEndSec < segmentStartSec)) {
|
|
onAnalyticsBinding = onAnalytics;
|
|
object2 = {};
|
|
startTimeMs = a0.startTimeMs;
|
|
object2.start_time = startTimeMs;
|
|
endTimeMs = a0.endTimeMs;
|
|
object2.end_time = endTimeMs;
|
|
endTimeMs = a0.endTimeMs;
|
|
startTimeMs = a0.startTimeMs;
|
|
object2.duration = endTimeMs - startTimeMs;
|
|
segmentStartSec = a0.segmentStartSec;
|
|
object2.segment_start_sec = segmentStartSec;
|
|
segmentEndSec = a0.segmentEndSec;
|
|
object2.segment_end_sec = segmentEndSec;
|
|
segmentEndSec = a0.segmentEndSec;
|
|
segmentStartSec = a0.segmentStartSec;
|
|
object2.segment_duration_sec = segmentEndSec - segmentStartSec;
|
|
onAnalyticsBinding(object2);
|
|
}
|
|
}
|
|
|
|
function _fun103424() { // fn#103424, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:838, offset: 0x02268172, size: 95 bytes, params: 1, frame: 15
|
|
var value3;
|
|
const currentVideoTime = getCurrentVideoTime();
|
|
if (currentVideoTime != null) {
|
|
if (env0_8) {
|
|
if (env0_10) {
|
|
value3 = global.Date.now();
|
|
env0_5({startTimeMs: value3, endTimeMs: value3, segmentStartSec: currentVideoTime,
|
|
segmentEndSec: currentVideoTime});
|
|
env0_14.current = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun103425() { // fn#103425, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:983, offset: 0x022681d1, size: 192 bytes, params: 1, frame: 17
|
|
var r7;
|
|
var r3;
|
|
var value3;
|
|
var value5;
|
|
var value6;
|
|
var minSegmentDurationMsBinding;
|
|
var binding;
|
|
var object2;
|
|
const currentVideoTime = getCurrentVideoTime();
|
|
if (currentVideoTime != null) {
|
|
if (env0_4 != null) {
|
|
value3 = global.Date.now();
|
|
value5 = value3 - env0_13.current < emitIntervalMs;
|
|
if (value5) {
|
|
r3 = value5;
|
|
} else {
|
|
value6 = currentVideoTime - env0_4.segmentStartSec;
|
|
minSegmentDurationMsBinding = minSegmentDurationMs;
|
|
r3 = value6 < minSegmentDurationMsBinding / 1000;
|
|
r7 = minSegmentDurationMsBinding;
|
|
}
|
|
if (!r3) {
|
|
binding = env0_15;
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_4, r7);
|
|
object2['endTimeMs'] = value3;
|
|
object2['segmentEndSec'] = currentVideoTime;
|
|
binding(object2);
|
|
binding = env0_5;
|
|
binding({startTimeMs: value3, endTimeMs: value3, segmentStartSec: currentVideoTime,
|
|
segmentEndSec: currentVideoTime});
|
|
env0_13.current = value3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun103426() { // fn#103426, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:1214, offset: 0x02268291, size: 46 bytes, params: 1, frame: 12
|
|
if (!(env0_8 && env0_10)) {
|
|
env0_5(null);
|
|
env0_14.current = false;
|
|
}
|
|
}
|
|
|
|
function _fun103427() { // fn#103427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:1260, offset: 0x022682bf, size: 273 bytes, params: 1, frame: 18
|
|
var currentVideoTime;
|
|
var value3;
|
|
var binding;
|
|
var object2;
|
|
var clearInterval;
|
|
if (env0_6) {
|
|
if (env0_8) {
|
|
if (env0_10) {
|
|
if (!env0_14.current) {
|
|
env0_16();
|
|
}
|
|
env0_12.current = global.window.setInterval(_fun103428, 200);
|
|
} else {
|
|
currentVideoTime = getCurrentVideoTime();
|
|
if (env0_4 != null) {
|
|
if (currentVideoTime != null) {
|
|
value3 = global.Date.now();
|
|
if (currentVideoTime - env0_4.segmentStartSec > 0.2) {
|
|
binding = env0_15;
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_4, value3);
|
|
object2['endTimeMs'] = value3;
|
|
object2['segmentEndSec'] = currentVideoTime;
|
|
binding(object2);
|
|
}
|
|
}
|
|
}
|
|
env0_5(null);
|
|
env0_14.current = false;
|
|
if (env0_12.current != null) {
|
|
clearInterval = global.clearInterval;
|
|
binding = env0_12;
|
|
clearInterval(binding.current);
|
|
binding.current = null;
|
|
}
|
|
}
|
|
} else {
|
|
currentVideoTime = getCurrentVideoTime();
|
|
if (env0_4 != null) {
|
|
if (currentVideoTime != null) {
|
|
value3 = global.Date.now();
|
|
if (currentVideoTime - env0_4.segmentStartSec > 0.2) {
|
|
binding = env0_15;
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_4, value3);
|
|
object2['endTimeMs'] = value3;
|
|
object2['segmentEndSec'] = currentVideoTime;
|
|
binding(object2);
|
|
}
|
|
}
|
|
}
|
|
env0_5(null);
|
|
env0_14.current = false;
|
|
if (env0_12.current != null) {
|
|
clearInterval = global.clearInterval;
|
|
binding = env0_12;
|
|
clearInterval(binding.current);
|
|
binding.current = null;
|
|
}
|
|
}
|
|
} else {
|
|
currentVideoTime = getCurrentVideoTime();
|
|
if (env0_4 != null) {
|
|
if (currentVideoTime != null) {
|
|
value3 = global.Date.now();
|
|
if (currentVideoTime - env0_4.segmentStartSec > 0.2) {
|
|
binding = env0_15;
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_4, value3);
|
|
object2['endTimeMs'] = value3;
|
|
object2['segmentEndSec'] = currentVideoTime;
|
|
binding(object2);
|
|
}
|
|
}
|
|
}
|
|
env0_5(null);
|
|
env0_14.current = false;
|
|
if (env0_12.current != null) {
|
|
clearInterval = global.clearInterval;
|
|
binding = env0_12;
|
|
clearInterval(binding.current);
|
|
binding.current = null;
|
|
}
|
|
}
|
|
return _fun103429;
|
|
}
|
|
|
|
function _fun103430() { // fn#103430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:1633, offset: 0x02268413, size: 135 bytes, params: 1, frame: 17
|
|
var value3;
|
|
var binding;
|
|
var object2;
|
|
const currentVideoTime = getCurrentVideoTime();
|
|
if (env0_4 != null) {
|
|
if (currentVideoTime != null) {
|
|
value3 = global.Date.now();
|
|
if (currentVideoTime - env0_4.segmentStartSec > 0.2) {
|
|
binding = env0_15;
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_4, value3);
|
|
object2['endTimeMs'] = value3;
|
|
object2['segmentEndSec'] = currentVideoTime;
|
|
binding(object2);
|
|
}
|
|
env0_5(null);
|
|
env0_14.current = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun103431(a0) { // fn#103431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:1835, offset: 0x0226849a, size: 155 bytes, params: 2, frame: 14
|
|
const VideoPlayerState = (require(7096) /* metro dependency 7096: DiscordVideoPlayerTypes */).VideoPlayerState;
|
|
const PLAYING = VideoPlayerState.PLAYING;
|
|
if (PLAYING === a0) {
|
|
env0_7(true);
|
|
} else if (VideoPlayerState.PAUSED === a0) {
|
|
env0_18.current();
|
|
env0_7(false);
|
|
} else if (VideoPlayerState.ENDED === a0) {
|
|
env0_18.current();
|
|
env0_7(false);
|
|
}
|
|
}
|
|
|
|
function _fun103433() { // fn#103433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:2051, offset: 0x02268535, size: 18 bytes, params: 1, frame: 11
|
|
env0_11(true);
|
|
}
|
|
|
|
function _fun103434() { // fn#103434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:2082, offset: 0x02268547, size: 20 bytes, params: 1, frame: 9
|
|
env0_18.current();
|
|
}
|
|
|
|
function _fun103428() { // fn#103428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:1321, offset: 0x022683d0, size: 15 bytes, params: 1, frame: 9
|
|
env1_17();
|
|
}
|
|
|
|
function _fun103429() { // fn#103429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13794:1538, offset: 0x022683df, size: 52 bytes, params: 1, frame: 13
|
|
var clearInterval;
|
|
var binding;
|
|
if (env1_12.current != null) {
|
|
clearInterval = global.clearInterval;
|
|
binding = env1_12;
|
|
clearInterval(binding.current);
|
|
binding.current = null;
|
|
}
|
|
}
|
|
|