Skip to content

Build your personal knowledge base with Trilium Notes

feat(video_player): add skip left/right buttons

Elian Doran1258d3282027
diff --git a/apps/client/src/widgets/type_widgets/file/Video.css b/apps/client/src/widgets/type_widgets/file/Video.css
index 88b405ed7f..39cf2562cf 100644
--- a/apps/client/src/widgets/type_widgets/file/Video.css
+++ b/apps/client/src/widgets/type_widgets/file/Video.css
@@ -25,6 +25,8 @@
> * {
flex: 1;
+ align-items: center;
+ gap: 0.5em;
}
.center {
diff --git a/apps/client/src/widgets/type_widgets/file/Video.tsx b/apps/client/src/widgets/type_widgets/file/Video.tsx
index b2f7804262..0b8b6ce0b4 100644
--- a/apps/client/src/widgets/type_widgets/file/Video.tsx
+++ b/apps/client/src/widgets/type_widgets/file/Video.tsx
@@ -28,6 +28,12 @@ export default function VideoPreview({ note }: { note: FNote }) {
}
};
+ const skip = (seconds: number) => {
+ const video = videoRef.current;
+ if (!video) return;
+ video.currentTime = Math.max(0, Math.min(video.duration, video.currentTime + seconds));
+ };
+
return (
<div className="video-preview-wrapper">
<video
@@ -44,12 +50,22 @@ export default function VideoPreview({ note }: { note: FNote }) {
<div class="video-buttons-row">
<div className="left" />
<div className="center">
+ <ActionButton
+ icon="bx bx-rewind"
+ text="Back 10s"
+ onClick={() => skip(-10)}
+ />
<ActionButton
className="play-button"
icon={playing ? "bx bx-pause" : "bx bx-play"}
text={playing ? "Pause" : "Play"}
onClick={togglePlayback}
/>
+ <ActionButton
+ icon="bx bx-fast-forward"
+ text="Forward 30s"
+ onClick={() => skip(30)}
+ />
</div>
<div className="right">
<VolumeControl videoRef={videoRef} />