From 583e335fc7cdc36de752dd784cce169e376f5b2e Mon Sep 17 00:00:00 2001 From: Uriel Date: Mon, 28 Oct 2024 18:29:36 +0100 Subject: [PATCH] fix status not working correctly --- gui/src/components/commons/PausableVideo.tsx | 15 +++++++++++++-- .../main/java/dev/slimevr/status/StatusSystem.kt | 5 +++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gui/src/components/commons/PausableVideo.tsx b/gui/src/components/commons/PausableVideo.tsx index ea6a3ff6e..9338bbd1c 100644 --- a/gui/src/components/commons/PausableVideo.tsx +++ b/gui/src/components/commons/PausableVideo.tsx @@ -1,16 +1,20 @@ import { useRef, useState } from 'react'; import { PlayCircleIcon } from './icon/PlayIcon'; import { useDebouncedEffect } from '@/hooks/timeout'; +import classNames from 'classnames'; export function PausableVideo({ src, poster, + restartOnPause = false, }: { src?: string; poster?: string; + restartOnPause?: boolean; }) { const videoRef = useRef(null); const [paused, setPaused] = useState(true); + const [atStart, setAtStart] = useState(true); function toggleVideo() { if (!videoRef.current) return; @@ -18,7 +22,10 @@ export function PausableVideo({ videoRef.current.play(); } else { videoRef.current.pause(); - videoRef.current.currentTime = 0; + if (restartOnPause) { + videoRef.current.currentTime = 0; + } + setAtStart(videoRef.current.currentTime === 0); } setPaused(videoRef.current.paused); } @@ -34,7 +41,11 @@ export function PausableVideo({ return (