mirror of
https://github.com/Qortal/q-tube.git
synced 2025-02-11 17:55:51 +00:00
Fixed bug where video duration was deleted when editing a video and NOT replacing its source.
Created TextField for manually entering the Video Duration when editing a video VideoPlayer.tsx background color when video doesn't cover full page is now black
This commit is contained in:
parent
d9f04030d5
commit
43663061ee
@ -11,7 +11,7 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { Signal, useSignal } from "@preact/signals-react";
|
import { Signal, useSignal, useSignalEffect } from "@preact/signals-react";
|
||||||
import Compressor from "compressorjs";
|
import Compressor from "compressorjs";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
@ -32,6 +32,7 @@ import {
|
|||||||
updateVideo,
|
updateVideo,
|
||||||
} from "../../../state/features/videoSlice.ts";
|
} from "../../../state/features/videoSlice.ts";
|
||||||
import { RootState } from "../../../state/store.ts";
|
import { RootState } from "../../../state/store.ts";
|
||||||
|
import BoundedNumericTextField from "../../../utils/BoundedNumericTextField.tsx";
|
||||||
import { objectToBase64 } from "../../../utils/PublishFormatter.ts";
|
import { objectToBase64 } from "../../../utils/PublishFormatter.ts";
|
||||||
import { FrameExtractor } from "../../common/FrameExtractor/FrameExtractor.tsx";
|
import { FrameExtractor } from "../../common/FrameExtractor/FrameExtractor.tsx";
|
||||||
import ImageUploader from "../../common/ImageUploader.tsx";
|
import ImageUploader from "../../common/ImageUploader.tsx";
|
||||||
@ -85,6 +86,10 @@ export const EditVideo = () => {
|
|||||||
editVideoProperties?.duration || 0,
|
editVideoProperties?.duration || 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
videoDuration.value[0] = Math.floor(editVideoProperties?.duration);
|
||||||
|
}, [editVideoProperties]);
|
||||||
|
|
||||||
const { getRootProps, getInputProps } = useDropzone({
|
const { getRootProps, getInputProps } = useDropzone({
|
||||||
accept: {
|
accept: {
|
||||||
"video/*": [],
|
"video/*": [],
|
||||||
@ -273,9 +278,9 @@ export const EditVideo = () => {
|
|||||||
videoType: file?.type || "video/mp4",
|
videoType: file?.type || "video/mp4",
|
||||||
filename: `${alphanumericString.trim()}.${fileExtension}`,
|
filename: `${alphanumericString.trim()}.${fileExtension}`,
|
||||||
fileSize: file?.size || 0,
|
fileSize: file?.size || 0,
|
||||||
duration: videoDuration.value[0],
|
duration: videoDuration.value[0] || editVideoProperties?.duration || 0,
|
||||||
};
|
};
|
||||||
|
console.log("edit publish duration: ", videoObject?.duration);
|
||||||
const metadescription =
|
const metadescription =
|
||||||
`**category:${category};subcategory:${subcategory};code:${editVideoProperties.code}**` +
|
`**category:${category};subcategory:${subcategory};code:${editVideoProperties.code}**` +
|
||||||
description.slice(0, 150);
|
description.slice(0, 150);
|
||||||
@ -408,7 +413,7 @@ export const EditVideo = () => {
|
|||||||
aria-labelledby="modal-title"
|
aria-labelledby="modal-title"
|
||||||
aria-describedby="modal-description"
|
aria-describedby="modal-description"
|
||||||
>
|
>
|
||||||
<ModalBody>
|
<ModalBody sx={{ maxHeight: "98vh" }}>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@ -517,6 +522,17 @@ export const EditVideo = () => {
|
|||||||
></TimesIcon>
|
></TimesIcon>
|
||||||
</LogoPreviewRow>
|
</LogoPreviewRow>
|
||||||
)}
|
)}
|
||||||
|
<BoundedNumericTextField
|
||||||
|
minValue={1}
|
||||||
|
maxValue={Number.MAX_SAFE_INTEGER}
|
||||||
|
label="Video Duration in Seconds"
|
||||||
|
addIconButtons={false}
|
||||||
|
allowDecimals={false}
|
||||||
|
initialValue={videoDuration.value[0].toString()}
|
||||||
|
afterChange={s => {
|
||||||
|
videoDuration.value[0] = +s;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<CustomInputField
|
<CustomInputField
|
||||||
name="title"
|
name="title"
|
||||||
label="Title of video"
|
label="Title of video"
|
||||||
|
@ -110,6 +110,7 @@ export const VideoPlayer = forwardRef<videoRefType, VideoPlayerProps>(
|
|||||||
style={{
|
style={{
|
||||||
...videoStyles?.video,
|
...videoStyles?.video,
|
||||||
objectFit: videoObjectFit.value,
|
objectFit: videoObjectFit.value,
|
||||||
|
backgroundColor: "#000000",
|
||||||
height:
|
height:
|
||||||
isFullscreen.value && showControls
|
isFullscreen.value && showControls
|
||||||
? "calc(100vh - 40px)"
|
? "calc(100vh - 40px)"
|
||||||
|
@ -13,7 +13,7 @@ export const fontSizeLarge = "120%";
|
|||||||
export const fontSizeExLarge = "150%";
|
export const fontSizeExLarge = "150%";
|
||||||
export const maxCommentLength = 10_000;
|
export const maxCommentLength = 10_000;
|
||||||
export const minFileSize = 1_000;
|
export const minFileSize = 1_000;
|
||||||
export const minDuration = 5;
|
export const minDuration = 1;
|
||||||
|
|
||||||
const newUIWidthDiff = 120;
|
const newUIWidthDiff = 120;
|
||||||
const smallScreenSize = 700 - newUIWidthDiff;
|
const smallScreenSize = 700 - newUIWidthDiff;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user