mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
Fix video looping instead of continuing playlist (#3007)
* Fix loop overriding continue queue * Add id to queue continue checkbox
This commit is contained in:
parent
396c1ffc6d
commit
bd44571a91
3 changed files with 23 additions and 5 deletions
|
|
@ -118,6 +118,7 @@ interface IScenePlayerProps {
|
||||||
scene: GQL.SceneDataFragment | undefined | null;
|
scene: GQL.SceneDataFragment | undefined | null;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
autoplay?: boolean;
|
autoplay?: boolean;
|
||||||
|
permitLoop?: boolean;
|
||||||
onComplete?: () => void;
|
onComplete?: () => void;
|
||||||
onNext?: () => void;
|
onNext?: () => void;
|
||||||
onPrevious?: () => void;
|
onPrevious?: () => void;
|
||||||
|
|
@ -128,6 +129,7 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
||||||
autoplay,
|
autoplay,
|
||||||
scene,
|
scene,
|
||||||
timestamp,
|
timestamp,
|
||||||
|
permitLoop = true,
|
||||||
onComplete,
|
onComplete,
|
||||||
onNext,
|
onNext,
|
||||||
onPrevious,
|
onPrevious,
|
||||||
|
|
@ -161,6 +163,16 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
||||||
|
|
||||||
const maxLoopDuration = config?.maximumLoopDuration ?? 0;
|
const maxLoopDuration = config?.maximumLoopDuration ?? 0;
|
||||||
|
|
||||||
|
const looping = useMemo(
|
||||||
|
() =>
|
||||||
|
!!file &&
|
||||||
|
!!file.duration &&
|
||||||
|
permitLoop &&
|
||||||
|
maxLoopDuration !== 0 &&
|
||||||
|
file.duration < maxLoopDuration,
|
||||||
|
[file, permitLoop, maxLoopDuration]
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (playerRef.current && timestamp >= 0) {
|
if (playerRef.current && timestamp >= 0) {
|
||||||
const player = playerRef.current;
|
const player = playerRef.current;
|
||||||
|
|
@ -170,6 +182,14 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
||||||
}
|
}
|
||||||
}, [timestamp]);
|
}, [timestamp]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (playerRef.current) {
|
||||||
|
const player = playerRef.current;
|
||||||
|
player.loop(looping);
|
||||||
|
interactiveClient.setLooping(looping);
|
||||||
|
}
|
||||||
|
}, [looping, interactiveClient]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const videoElement = videoRef.current;
|
const videoElement = videoRef.current;
|
||||||
if (!videoElement) return;
|
if (!videoElement) return;
|
||||||
|
|
@ -554,10 +574,6 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
||||||
|
|
||||||
player.currentTime(0);
|
player.currentTime(0);
|
||||||
|
|
||||||
const looping =
|
|
||||||
!!file.duration &&
|
|
||||||
maxLoopDuration !== 0 &&
|
|
||||||
file.duration < maxLoopDuration;
|
|
||||||
player.loop(looping);
|
player.loop(looping);
|
||||||
interactiveClient.setLooping(looping);
|
interactiveClient.setLooping(looping);
|
||||||
|
|
||||||
|
|
@ -594,7 +610,7 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
||||||
scene,
|
scene,
|
||||||
file,
|
file,
|
||||||
config?.autostartVideo,
|
config?.autostartVideo,
|
||||||
maxLoopDuration,
|
looping,
|
||||||
initialTimestamp,
|
initialTimestamp,
|
||||||
autoplay,
|
autoplay,
|
||||||
interactiveClient,
|
interactiveClient,
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ export const QueueViewer: React.FC<IPlaylistViewer> = ({
|
||||||
<div className="queue-controls">
|
<div className="queue-controls">
|
||||||
<div>
|
<div>
|
||||||
<Form.Check
|
<Form.Check
|
||||||
|
id="continue-checkbox"
|
||||||
checked={continuePlaylist}
|
checked={continuePlaylist}
|
||||||
label={intl.formatMessage({ id: "actions.continue" })}
|
label={intl.formatMessage({ id: "actions.continue" })}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
|
|
|
||||||
|
|
@ -720,6 +720,7 @@ const SceneLoader: React.FC = () => {
|
||||||
scene={scene}
|
scene={scene}
|
||||||
timestamp={timestamp}
|
timestamp={timestamp}
|
||||||
autoplay={autoplay}
|
autoplay={autoplay}
|
||||||
|
permitLoop={!continuePlaylist}
|
||||||
onComplete={onComplete}
|
onComplete={onComplete}
|
||||||
onNext={
|
onNext={
|
||||||
currentQueueIndex >= 0 && currentQueueIndex < queueScenes.length - 1
|
currentQueueIndex >= 0 && currentQueueIndex < queueScenes.length - 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue