Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes for video duration #873

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/common/CreateVideoDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const CreateVideoDialog = ({
speakerInfo,
speakerType,
setSpeakerType,
duration,
setDuration,
}) => {
const userOrgId = getLocalStorageData("userData").organization.id;

Expand All @@ -80,10 +82,16 @@ const CreateVideoDialog = ({

const videosInProject = useSelector((state)=>state.getProjectVideoList.data)
const [showPopup, setShowPopup] = useState(false);
const [showDurationSelector, setDurationSelector] = useState(false);
useEffect(() => {
if (videosInProject.some((video) => video.url === videoLink)) {
setShowPopup(true);
}
if (videoLink.length > 10 & !videoLink.includes("youtube")){
setDurationSelector(true);
}else{
setDurationSelector(false);
}
}, [videoLink, videosInProject]);

const handleClear = () => {
Expand Down Expand Up @@ -249,6 +257,17 @@ const CreateVideoDialog = ({
onChange={(event) => setVideoLink(event.target.value)}
sx={{ mt: 3 }}
/>

{showDurationSelector &&
<TextField
label={"Video Duration"}
fullWidth
defaultValue="00:00:00"
rows={1}
value={duration}
onChange={(event) => setDuration(event.target.value)}
sx={{ mt: 3 }}
/>}
{showPopup && (
<div
style={{
Expand Down
9 changes: 7 additions & 2 deletions src/containers/Organization/Project/Project.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useNavigate, useParams } from "react-router-dom";
import moment from "moment/moment";
import moment, { duration } from "moment/moment";
import { roles } from "utils";

//APIs
Expand Down Expand Up @@ -80,6 +80,7 @@ const Project = () => {
const [projectDetails, SetProjectDetails] = useState({});
const [videoList, setVideoList] = useState([]);
const [createVideoDialog, setCreateVideoDialog] = useState(false);
const [duration, setDuration] = useState("00:00:00");
const [videoLink, setVideoLink] = useState("");
const [isAudio, setIsAudio] = useState(false);
const [lang, setLang] = useState("");
Expand Down Expand Up @@ -245,6 +246,7 @@ const Project = () => {
const addNewVideoHandler = async () => {
const link = encodeURIComponent(videoLink.replace(/&amp;/g, "&"));
const desc = encodeURIComponent(videoDescription.replace(/&amp;/g, "&"));
const dur = encodeURIComponent(duration);
const create = true;

dispatch(
Expand All @@ -264,7 +266,8 @@ const Project = () => {
create,
voice,
speakerInfo,
speakerType
speakerType,
dur
);
dispatch(APITransport(apiObj));

Expand Down Expand Up @@ -527,6 +530,8 @@ const Project = () => {
speakerInfo={speakerInfo}
speakerType={speakerType}
setSpeakerType={setSpeakerType}
duration={duration}
setDuration={setDuration}
/>
)}

Expand Down
6 changes: 4 additions & 2 deletions src/redux/actions/api/Project/CreateNewVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class CreateNewVideoAPI extends API {
gender,
speakerInfo,
speakerType,
duration,
timeout = 2000
) {
super("GET", timeout, false);
Expand All @@ -25,12 +26,13 @@ export default class CreateNewVideoAPI extends API {
this.gender = gender;
this.speakerInfo = speakerInfo;
this.speakerType = speakerType;
this.duration = duration;
this.query =
this.speakerType === "multiple"
? `?multimedia_url=${url}&lang=${language}&is_audio_only=${isAudio}&project_id=${projectId}&description=${description}&create=${create}&gender=${gender}&speaker_info=${JSON.stringify(
speakerInfo
)}&multiple_speaker=true`
: `?multimedia_url=${url}&lang=${language}&is_audio_only=${isAudio}&project_id=${projectId}&description=${description}&create=${create}&gender=${gender}&multiple_speaker=false`;
)}&multiple_speaker=true&duration=${duration}`
: `?multimedia_url=${url}&lang=${language}&is_audio_only=${isAudio}&project_id=${projectId}&description=${description}&create=${create}&gender=${gender}&multiple_speaker=false&duration=${duration}`;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.video}${this.query}`;
}

Expand Down