UPDATE "endPoint" to "duration" in frontend to match backend
This commit is contained in:
@@ -33,7 +33,7 @@ export default function ClipRangeSlider({videoRef,
|
|||||||
setMetadata((prevState: VideoMetadata) => ({
|
setMetadata((prevState: VideoMetadata) => ({
|
||||||
...prevState,
|
...prevState,
|
||||||
startPoint: val[0],
|
startPoint: val[0],
|
||||||
endPoint: val[1]
|
duration: val[1] - val[0]
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
previousRangeSliderInput.current = val;
|
previousRangeSliderInput.current = val;
|
||||||
@@ -42,7 +42,7 @@ export default function ClipRangeSlider({videoRef,
|
|||||||
return (
|
return (
|
||||||
<RangeSlider
|
<RangeSlider
|
||||||
min={0}
|
min={0}
|
||||||
max={videoMetadata.endPoint}
|
max={videoMetadata.duration}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
onInput={handleRangeSliderInput}
|
onInput={handleRangeSliderInput}
|
||||||
className={clsx(className)}
|
className={clsx(className)}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export default function PlaybackSlider({videoRef,
|
|||||||
sliderValue,
|
sliderValue,
|
||||||
setSliderValue,
|
setSliderValue,
|
||||||
className}: Props) {
|
className}: Props) {
|
||||||
|
|
||||||
const updateVideo = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const updateVideo = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
if (!videoRef) return;
|
if (!videoRef) return;
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ export default function PlaybackSlider({videoRef,
|
|||||||
<input
|
<input
|
||||||
type={"range"}
|
type={"range"}
|
||||||
min={0}
|
min={0}
|
||||||
max={videoMetadata.endPoint}
|
max={videoMetadata.duration}
|
||||||
value={sliderValue}
|
value={sliderValue}
|
||||||
onChange={updateVideo}
|
onChange={updateVideo}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ export default function Playbar({ video, videoMetadata, className }: Props) {
|
|||||||
>
|
>
|
||||||
{isPlaying ? <Pause size={24} /> : <Play size={24} />}
|
{isPlaying ? <Pause size={24} /> : <Play size={24} />}
|
||||||
</button>
|
</button>
|
||||||
{videoMetadata.endPoint &&
|
|
||||||
<label>
|
<label>
|
||||||
{formatTime(video?.currentTime ?? 0)} / {formatTime(videoMetadata.endPoint)}
|
{formatTime(video?.currentTime ?? 0)} / {formatTime(videoMetadata.duration ?? 0)}
|
||||||
</label>
|
</label>
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ const ClipEdit = () => {
|
|||||||
title: "",
|
title: "",
|
||||||
description: "",
|
description: "",
|
||||||
startPoint: 0,
|
startPoint: 0,
|
||||||
endPoint: 5,
|
duration: 5,
|
||||||
width: 1280,
|
width: 1280,
|
||||||
height: 720,
|
height: 720,
|
||||||
fps: 30,
|
fps: 30,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ type VideoMetadata = {
|
|||||||
title: string,
|
title: string,
|
||||||
description: string,
|
description: string,
|
||||||
startPoint: number,
|
startPoint: number,
|
||||||
endPoint: number,
|
duration: number,
|
||||||
fps: number,
|
fps: number,
|
||||||
width: number,
|
width: number,
|
||||||
height: number,
|
height: number,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class EditService {
|
|||||||
|
|
||||||
private void validateClipConfig(ClipOptions clipOptions) {
|
private void validateClipConfig(ClipOptions clipOptions) {
|
||||||
Float start = clipOptions.getStartPoint();
|
Float start = clipOptions.getStartPoint();
|
||||||
Float end = clipOptions.getDuration();
|
Float duration = clipOptions.getDuration();
|
||||||
Float fileSize = clipOptions.getFileSize();
|
Float fileSize = clipOptions.getFileSize();
|
||||||
Integer width = clipOptions.getWidth();
|
Integer width = clipOptions.getWidth();
|
||||||
Integer height = clipOptions.getHeight();
|
Integer height = clipOptions.getHeight();
|
||||||
@@ -47,12 +47,8 @@ public class EditService {
|
|||||||
throw new IllegalArgumentException("Start point cannot be negative");
|
throw new IllegalArgumentException("Start point cannot be negative");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end != null && end < 0) {
|
if (duration != null && duration < 0) {
|
||||||
throw new IllegalArgumentException("End point cannot be negative");
|
throw new IllegalArgumentException("Duration cannot be negative");
|
||||||
}
|
|
||||||
|
|
||||||
if (start != null && end != null && end <= start) {
|
|
||||||
throw new IllegalArgumentException("End point must be greater than start point");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileSize != null && fileSize < 100) {
|
if (fileSize != null && fileSize < 100) {
|
||||||
|
|||||||
Reference in New Issue
Block a user