decord/source/modules/media_viewer/native/useVideoControls.tsx

121 lines
4.3 KiB
TypeScript
Raw Normal View History

2026-09-01 10:26:29 +00:00
// Module ID: 8574
// Function ID: 8575
2026-07-20 16:05:17 +00:00
// Name: useVideoControls
2026-09-01 10:26:29 +00:00
// Dependencies: [32, 19, 4470, 21, 644, 705, 8575, 4478, 589, 8567, 8576, 8568, 8577, 2]
2026-07-20 16:05:17 +00:00
// Exports: default, initVideoStateStore, setMuted, setPausedState, setVideoStateControls, toggleMuted, tryPauseCurrentVideo, unpauseCurrentVideoIfNeeded
2026-09-01 10:26:29 +00:00
// Module 8574 (useVideoControls)
2026-08-24 06:08:38 +00:00
import batchUpdates from "batchUpdates" /* 705 */;
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "noop" /* 19 */;
2026-09-01 10:26:29 +00:00
import closure_5 from "maybeApplyNoTextColorForLightCustomTheme" /* 4470 */;
2026-08-24 06:08:38 +00:00
import { jsx } from "jsxProd" /* 21 */;
import keys from "keys" /* 644 */;
2026-09-01 10:26:29 +00:00
import createCacheKey from "createCacheKey" /* 4478 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-09-01 10:26:29 +00:00
keys = keys.create(() => ({ controls: "PX_16", paused: null }));
2026-07-29 08:29:29 +00:00
let closure_8 = createCacheKey.createStyles({ slider: { marginBottom: 8 } });
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/media_viewer/native/useVideoControls.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default function useVideoControls(arg0, portal) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-08-24 06:08:38 +00:00
importDefault = arg2;
2026-07-23 10:11:24 +00:00
let obj = _require(stateFromStores[8]);
2026-08-24 06:08:38 +00:00
const items = [closure_5];
stateFromStores = obj.useStateFromStores(items, () => useReducedMotion.useReducedMotion);
2026-07-29 08:29:29 +00:00
const tmp5 = callback(state.useState(false), 2);
callback = tmp6;
2026-07-23 10:11:24 +00:00
const MediaViewerSourcesStore = _require(stateFromStores[9]).MediaViewerSourcesStore;
state = MediaViewerSourcesStore.useState((spoilerIndexes) => {
2026-07-20 16:05:17 +00:00
spoilerIndexes = spoilerIndexes.spoilerIndexes;
2026-07-23 10:11:24 +00:00
return spoilerIndexes.has(closure_0);
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
const tmp9 = importDefault(stateFromStores[10])(arg0);
2026-08-24 06:08:38 +00:00
closure_5 = tmp9;
2026-07-29 08:29:29 +00:00
let result = null != arg2;
2026-07-20 16:05:17 +00:00
if (result) {
2026-07-29 08:29:29 +00:00
result = tmp2(tmp3[11]).supportOverlayVideoControls(portal);
const tmp2Result = tmp2(tmp3[11]);
2026-07-20 16:05:17 +00:00
}
let videoURI = portal.portal;
2026-07-29 08:29:29 +00:00
if (videoURI == null) {
2026-07-20 16:05:17 +00:00
videoURI = portal.videoURI;
}
2026-07-29 08:29:29 +00:00
const tmp11 = importDefault(stateFromStores[10])(videoURI);
2026-08-24 06:08:38 +00:00
closure_7 = tmp11;
2026-07-29 08:29:29 +00:00
const items1 = [arg2, videoURI, stateFromStores, tmp11, state, tmp9, arg0];
2026-07-23 10:11:24 +00:00
const effect = state.useEffect(() => {
2026-08-24 06:08:38 +00:00
if (closure_5 !== closure_0) {
2026-07-29 08:29:29 +00:00
if (null != tmp) {
2026-07-20 16:05:17 +00:00
if (null != videoURI) {
2026-07-29 08:29:29 +00:00
if (closure_7 !== tmp3) {
closure_1.seek(0);
let tmp6 = state;
2026-07-20 16:05:17 +00:00
if (!state) {
2026-07-29 08:29:29 +00:00
tmp6 = stateFromStores;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
closure_1.pause(tmp6);
2026-08-24 06:08:38 +00:00
callback2(tmp6);
2026-07-29 08:29:29 +00:00
const obj = closure_1;
2026-07-20 16:05:17 +00:00
}
}
}
}
}, items1);
[][0] = arg0;
if (result) {
2026-07-29 08:29:29 +00:00
obj = { style: null, controls: null, paused: null, setPaused: null, onPlayPress: null };
obj[0] = tmp.slider;
obj[1] = arg2;
obj[2] = tmp5[0];
obj[3] = tmp6;
obj[4] = tmp13;
return videoURI(tmp8(tmp3[12]), obj, videoURI);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj2 = state;
2026-07-23 10:11:24 +00:00
tmp = callback2();
2026-07-29 08:29:29 +00:00
tmp2 = _require;
2026-07-20 16:05:17 +00:00
};
2026-07-23 10:11:24 +00:00
export const useVideoStateStore = keys;
2026-07-20 16:05:17 +00:00
export const initVideoStateStore = function initVideoStateStore() {
2026-08-24 06:08:38 +00:00
batchUpdates.batchUpdates(() => {
2026-09-01 10:26:29 +00:00
state.setState({ controls: "PX_16", paused: null });
2026-07-20 16:05:17 +00:00
});
};
export const setMuted = function setMuted(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-07-29 08:29:29 +00:00
_require(705).batchUpdates(() => {
2026-08-24 06:08:38 +00:00
const useMediaPlayerMutedStore = callback(closure_1_2[6]).useMediaPlayerMutedStore;
2026-07-23 10:11:24 +00:00
useMediaPlayerMutedStore.setState({ isMuted: callback });
2026-07-20 16:05:17 +00:00
});
};
export const toggleMuted = function toggleMuted() {
2026-08-24 06:08:38 +00:00
batchUpdates.batchUpdates(() => {
2026-07-29 08:29:29 +00:00
const useMediaPlayerMutedStore = callback(table[6]).useMediaPlayerMutedStore;
2026-07-20 16:05:17 +00:00
useMediaPlayerMutedStore.setState((isMuted) => ({ isMuted: !isMuted.isMuted }));
});
};
export const setVideoStateControls = function setVideoStateControls(videoControls) {
2026-07-23 10:11:24 +00:00
const _require = videoControls;
2026-08-24 06:08:38 +00:00
_require(705).batchUpdates(() => closure_1_7.setState({ controls: closure_0 }));
2026-07-20 16:05:17 +00:00
};
export const setPausedState = function setPausedState(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-08-24 06:08:38 +00:00
_require(705).batchUpdates(() => closure_1_7.setState({ paused: closure_0 }));
2026-07-20 16:05:17 +00:00
};
export const tryPauseCurrentVideo = function tryPauseCurrentVideo() {
2026-07-23 10:11:24 +00:00
const controls = keys.getState().controls;
2026-07-29 08:29:29 +00:00
if (controls != null) {
2026-07-20 16:05:17 +00:00
controls.pause(true);
}
};
export const unpauseCurrentVideoIfNeeded = function unpauseCurrentVideoIfNeeded() {
2026-07-29 08:29:29 +00:00
if (!keys.getState().paused) {
2026-07-23 10:11:24 +00:00
const controls = keys.getState().controls;
2026-07-29 08:29:29 +00:00
if (controls != null) {
controls.pause(false);
}
2026-07-20 16:05:17 +00:00
}
};