Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(video_player): add loop button
Elian Doran8af35da2795c
diff --git a/apps/client/src/widgets/type_widgets/file/Video.tsx b/apps/client/src/widgets/type_widgets/file/Video.tsxindex f160afb806..00df647138 100644--- a/apps/client/src/widgets/type_widgets/file/Video.tsx+++ b/apps/client/src/widgets/type_widgets/file/Video.tsx@@ -51,6 +51,7 @@ export default function VideoPreview({ note }: { note: FNote }) {<div className="left"><PlaybackSpeed videoRef={videoRef} /><RotateButton videoRef={videoRef} />+ <LoopButton videoRef={videoRef} /></div><div className="center"><SkipButton videoRef={videoRef} seconds={-10} icon="bx bx-rewind" text="Back 10s" />@@ -254,6 +255,26 @@ function PlaybackSpeed({ videoRef }: { videoRef: RefObject<HTMLVideoElement> }));}+function LoopButton({ videoRef }: { videoRef: RefObject<HTMLVideoElement> }) {+ const [loop, setLoop] = useState(false);++ const toggle = () => {+ const video = videoRef.current;+ if (!video) return;+ video.loop = !video.loop;+ setLoop(video.loop);+ };++ return (+ <ActionButton+ className={loop ? "active" : ""}+ icon="bx bx-repeat"+ text={loop ? "Disable loop" : "Loop"}+ onClick={toggle}+ />+ );+}+function RotateButton({ videoRef }: { videoRef: RefObject<HTMLVideoElement> }) {const [rotation, setRotation] = useState(0);