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

120 lines
4.3 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 8745
// Function ID: 8746
2026-07-20 16:05:17 +00:00
// Name: useVideoControls
2026-08-05 07:35:12 +00:00
// Dependencies: [32, 19, 4247, 21, 644, 705, 8746, 4255, 589, 8739, 8747, 8740, 8748, 2]
2026-07-20 16:05:17 +00:00
// Exports: default, initVideoStateStore, setMuted, setPausedState, setVideoStateControls, toggleMuted, tryPauseCurrentVideo, unpauseCurrentVideoIfNeeded
2026-08-05 07:35:12 +00:00
// Module 8745 (useVideoControls)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import noop from "noop";
import maybeApplyNoTextColorForLightCustomTheme from "maybeApplyNoTextColorForLightCustomTheme";
2026-07-23 10:11:24 +00:00
import { jsx } from "jsxProd";
import keys from "keys";
2026-07-29 08:29:29 +00:00
import createCacheKey from "createCacheKey";
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-05 07:35:12 +00:00
keys = keys.create(() => ({ controls: "PX_8", paused: "Array" }));
2026-07-29 08:29:29 +00:00
let closure_8 = createCacheKey.createStyles({ slider: { marginBottom: 8 } });
let result = require("maybeApplyNoTextColorForLightCustomTheme").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-07-29 08:29:29 +00:00
const importDefault = arg2;
2026-07-23 10:11:24 +00:00
let obj = _require(stateFromStores[8]);
2026-07-29 08:29:29 +00:00
const items = [maybeApplyNoTextColorForLightCustomTheme];
stateFromStores = obj.useStateFromStores(items, () => tmp9.useReducedMotion);
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);
maybeApplyNoTextColorForLightCustomTheme = tmp9;
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);
const keys = tmp11;
const items1 = [arg2, videoURI, stateFromStores, tmp11, state, tmp9, arg0];
2026-07-23 10:11:24 +00:00
const effect = state.useEffect(() => {
2026-07-29 08:29:29 +00:00
if (maybeApplyNoTextColorForLightCustomTheme !== closure_0) {
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);
tmp6(tmp6);
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-07-29 08:29:29 +00:00
require(705) /* batchUpdates */.batchUpdates(() => {
2026-08-05 07:35:12 +00:00
state.setState({ controls: "PX_8", paused: "Array" });
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-07-23 10:11:24 +00:00
const useMediaPlayerMutedStore = callback(outer1_2[6]).useMediaPlayerMutedStore;
useMediaPlayerMutedStore.setState({ isMuted: callback });
2026-07-20 16:05:17 +00:00
});
};
export const toggleMuted = function toggleMuted() {
2026-07-29 08:29:29 +00:00
require(705) /* batchUpdates */.batchUpdates(() => {
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-07-29 08:29:29 +00:00
_require(705).batchUpdates(() => outer1_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-07-29 08:29:29 +00:00
_require(705).batchUpdates(() => outer1_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
}
};