UPDATE "endPoint" to "duration" in frontend to match backend

This commit is contained in:
2025-12-06 23:32:15 +00:00
parent d5017bb333
commit 08ef00c22e
6 changed files with 14 additions and 17 deletions

View File

@@ -33,7 +33,7 @@ export default function ClipRangeSlider({videoRef,
setMetadata((prevState: VideoMetadata) => ({
...prevState,
startPoint: val[0],
endPoint: val[1]
duration: val[1] - val[0]
}
))
previousRangeSliderInput.current = val;
@@ -42,7 +42,7 @@ export default function ClipRangeSlider({videoRef,
return (
<RangeSlider
min={0}
max={videoMetadata.endPoint}
max={videoMetadata.duration}
step={0.1}
onInput={handleRangeSliderInput}
className={clsx(className)}

View File

@@ -15,6 +15,7 @@ export default function PlaybackSlider({videoRef,
sliderValue,
setSliderValue,
className}: Props) {
const updateVideo = (e: React.ChangeEvent<HTMLInputElement>) => {
if (!videoRef) return;
@@ -41,7 +42,7 @@ export default function PlaybackSlider({videoRef,
<input
type={"range"}
min={0}
max={videoMetadata.endPoint}
max={videoMetadata.duration}
value={sliderValue}
onChange={updateVideo}
step={0.1}

View File

@@ -81,11 +81,11 @@ export default function Playbar({ video, videoMetadata, className }: Props) {
>
{isPlaying ? <Pause size={24} /> : <Play size={24} />}
</button>
{videoMetadata.endPoint &&
<label>
{formatTime(video?.currentTime ?? 0)} / {formatTime(videoMetadata.endPoint)}
</label>
}
<label>
{formatTime(video?.currentTime ?? 0)} / {formatTime(videoMetadata.duration ?? 0)}
</label>
</div>
);
}

View File

@@ -21,7 +21,7 @@ const ClipEdit = () => {
title: "",
description: "",
startPoint: 0,
endPoint: 5,
duration: 5,
width: 1280,
height: 720,
fps: 30,

View File

@@ -2,7 +2,7 @@ type VideoMetadata = {
title: string,
description: string,
startPoint: number,
endPoint: number,
duration: number,
fps: number,
width: number,
height: number,