119 lines
4.3 KiB
TypeScript
119 lines
4.3 KiB
TypeScript
// Module ID: 8900
|
|
// Function ID: 8901
|
|
// Name: useVideoControls
|
|
// Dependencies: [32, 19, 4334, 21, 644, 705, 8901, 4342, 589, 8894, 8902, 8895, 8903, 2]
|
|
// Exports: default, initVideoStateStore, setMuted, setPausedState, setVideoStateControls, toggleMuted, tryPauseCurrentVideo, unpauseCurrentVideoIfNeeded
|
|
|
|
// Module 8900 (useVideoControls)
|
|
import _slicedToArray from "_slicedToArray";
|
|
import noop from "noop";
|
|
import maybeApplyNoTextColorForLightCustomTheme from "maybeApplyNoTextColorForLightCustomTheme";
|
|
import { jsx } from "jsxProd";
|
|
import keys from "keys";
|
|
import createCacheKey from "createCacheKey";
|
|
|
|
const require = arg1;
|
|
keys = keys.create(() => ({ controls: "ct", paused: true }));
|
|
let closure_8 = createCacheKey.createStyles({ slider: { marginBottom: 8 } });
|
|
let result = require("maybeApplyNoTextColorForLightCustomTheme").fileFinishedImporting("modules/media_viewer/native/useVideoControls.tsx");
|
|
|
|
export default function useVideoControls(arg0, portal) {
|
|
const _require = arg0;
|
|
const importDefault = arg2;
|
|
let obj = _require(stateFromStores[8]);
|
|
const items = [maybeApplyNoTextColorForLightCustomTheme];
|
|
stateFromStores = obj.useStateFromStores(items, () => tmp9.useReducedMotion);
|
|
const tmp5 = callback(state.useState(false), 2);
|
|
callback = tmp6;
|
|
const MediaViewerSourcesStore = _require(stateFromStores[9]).MediaViewerSourcesStore;
|
|
state = MediaViewerSourcesStore.useState((spoilerIndexes) => {
|
|
spoilerIndexes = spoilerIndexes.spoilerIndexes;
|
|
return spoilerIndexes.has(closure_0);
|
|
});
|
|
const tmp9 = importDefault(stateFromStores[10])(arg0);
|
|
maybeApplyNoTextColorForLightCustomTheme = tmp9;
|
|
let result = null != arg2;
|
|
if (result) {
|
|
result = tmp2(tmp3[11]).supportOverlayVideoControls(portal);
|
|
const tmp2Result = tmp2(tmp3[11]);
|
|
}
|
|
let videoURI = portal.portal;
|
|
if (videoURI == null) {
|
|
videoURI = portal.videoURI;
|
|
}
|
|
const tmp11 = importDefault(stateFromStores[10])(videoURI);
|
|
const keys = tmp11;
|
|
const items1 = [arg2, videoURI, stateFromStores, tmp11, state, tmp9, arg0];
|
|
const effect = state.useEffect(() => {
|
|
if (maybeApplyNoTextColorForLightCustomTheme !== closure_0) {
|
|
if (null != tmp) {
|
|
if (null != videoURI) {
|
|
if (closure_7 !== tmp3) {
|
|
closure_1.seek(0);
|
|
let tmp6 = state;
|
|
if (!state) {
|
|
tmp6 = stateFromStores;
|
|
}
|
|
closure_1.pause(tmp6);
|
|
tmp6(tmp6);
|
|
const obj = closure_1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, items1);
|
|
[][0] = arg0;
|
|
if (result) {
|
|
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);
|
|
}
|
|
const obj2 = state;
|
|
tmp = callback2();
|
|
tmp2 = _require;
|
|
};
|
|
export const useVideoStateStore = keys;
|
|
export const initVideoStateStore = function initVideoStateStore() {
|
|
require(705) /* batchUpdates */.batchUpdates(() => {
|
|
state.setState({ controls: "ct", paused: true });
|
|
});
|
|
};
|
|
export const setMuted = function setMuted(arg0) {
|
|
const _require = arg0;
|
|
_require(705).batchUpdates(() => {
|
|
const useMediaPlayerMutedStore = callback(outer1_2[6]).useMediaPlayerMutedStore;
|
|
useMediaPlayerMutedStore.setState({ isMuted: callback });
|
|
});
|
|
};
|
|
export const toggleMuted = function toggleMuted() {
|
|
require(705) /* batchUpdates */.batchUpdates(() => {
|
|
const useMediaPlayerMutedStore = callback(table[6]).useMediaPlayerMutedStore;
|
|
useMediaPlayerMutedStore.setState((isMuted) => ({ isMuted: !isMuted.isMuted }));
|
|
});
|
|
};
|
|
export const setVideoStateControls = function setVideoStateControls(videoControls) {
|
|
const _require = videoControls;
|
|
_require(705).batchUpdates(() => outer1_7.setState({ controls: closure_0 }));
|
|
};
|
|
export const setPausedState = function setPausedState(arg0) {
|
|
const _require = arg0;
|
|
_require(705).batchUpdates(() => outer1_7.setState({ paused: closure_0 }));
|
|
};
|
|
export const tryPauseCurrentVideo = function tryPauseCurrentVideo() {
|
|
const controls = keys.getState().controls;
|
|
if (controls != null) {
|
|
controls.pause(true);
|
|
}
|
|
};
|
|
export const unpauseCurrentVideoIfNeeded = function unpauseCurrentVideoIfNeeded() {
|
|
if (!keys.getState().paused) {
|
|
const controls = keys.getState().controls;
|
|
if (controls != null) {
|
|
controls.pause(false);
|
|
}
|
|
}
|
|
};
|