mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
prettier and some refactor
This commit is contained in:
parent
29cf90c59c
commit
2ee1bea720
3 changed files with 19 additions and 25 deletions
|
|
@ -440,7 +440,11 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = PatchComponent(
|
||||||
};
|
};
|
||||||
// empty deps - only init once
|
// empty deps - only init once
|
||||||
// showAbLoopControls is necessary to re-init the player when the config changes
|
// showAbLoopControls is necessary to re-init the player when the config changes
|
||||||
}, [uiConfig?.showAbLoopControls, uiConfig?.enableChromecast, interfaceConfig?.autostartVideo]);
|
}, [
|
||||||
|
uiConfig?.showAbLoopControls,
|
||||||
|
uiConfig?.enableChromecast,
|
||||||
|
interfaceConfig?.autostartVideo,
|
||||||
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const player = getPlayer();
|
const player = getPlayer();
|
||||||
|
|
@ -487,17 +491,6 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = PatchComponent(
|
||||||
vrMenu.setShowButton(showButton);
|
vrMenu.setShowButton(showButton);
|
||||||
}, [getPlayer, scene, vrTag]);
|
}, [getPlayer, scene, vrTag]);
|
||||||
|
|
||||||
// Sync autostart button with config changes
|
|
||||||
useEffect(() => {
|
|
||||||
const player = getPlayer();
|
|
||||||
if (!player) return;
|
|
||||||
|
|
||||||
const autostartButton = player.autostartButton();
|
|
||||||
if (autostartButton) {
|
|
||||||
autostartButton.syncWithConfig(interfaceConfig?.autostartVideo ?? false);
|
|
||||||
}
|
|
||||||
}, [getPlayer, interfaceConfig?.autostartVideo]);
|
|
||||||
|
|
||||||
// Player event handlers
|
// Player event handlers
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const player = getPlayer();
|
const player = getPlayer();
|
||||||
|
|
@ -862,11 +855,11 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = PatchComponent(
|
||||||
sceneSaveActivity,
|
sceneSaveActivity,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Sync autostart button with config changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const player = getPlayer();
|
const player = getPlayer();
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|
||||||
async function updateAutoStart(enabled: boolean) {
|
async function updateAutoStart(enabled: boolean) {
|
||||||
await updateInterfaceConfig({
|
await updateInterfaceConfig({
|
||||||
variables: {
|
variables: {
|
||||||
|
|
@ -875,12 +868,16 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = PatchComponent(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log("updated interface config");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const autostartButton = player.autostartButton();
|
const autostartButton = player.autostartButton();
|
||||||
|
if (autostartButton) {
|
||||||
|
autostartButton.syncWithConfig(
|
||||||
|
interfaceConfig?.autostartVideo ?? false
|
||||||
|
);
|
||||||
autostartButton.updateAutoStart = updateAutoStart;
|
autostartButton.updateAutoStart = updateAutoStart;
|
||||||
}, [getPlayer, updateInterfaceConfig]);
|
}
|
||||||
|
}, [getPlayer, updateInterfaceConfig, interfaceConfig?.autostartVideo]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const player = getPlayer();
|
const player = getPlayer();
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,7 @@ class AutostartButton extends videojs.getComponent("Button") {
|
||||||
class AutostartButtonPlugin extends videojs.getPlugin("plugin") {
|
class AutostartButtonPlugin extends videojs.getPlugin("plugin") {
|
||||||
private button: AutostartButton;
|
private button: AutostartButton;
|
||||||
private autostartEnabled: boolean;
|
private autostartEnabled: boolean;
|
||||||
updateAutoStart: (enabled: boolean) => Promise<void> =
|
updateAutoStart: (enabled: boolean) => Promise<void> = () => {
|
||||||
() => {
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -122,4 +121,3 @@ declare module "video.js" {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AutostartButtonPlugin;
|
export default AutostartButtonPlugin;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,6 @@ $sceneTabWidth: 450px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.vjs-touch-overlay .vjs-play-control {
|
.vjs-touch-overlay .vjs-play-control {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue