diff --git a/src/common/CreateVideoDialog.jsx b/src/common/CreateVideoDialog.jsx index 56a5e92a..1f0bb49c 100644 --- a/src/common/CreateVideoDialog.jsx +++ b/src/common/CreateVideoDialog.jsx @@ -62,6 +62,8 @@ const CreateVideoDialog = ({ speakerInfo, speakerType, setSpeakerType, + duration, + setDuration, }) => { const userOrgId = getLocalStorageData("userData").organization.id; @@ -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 = () => { @@ -249,6 +257,17 @@ const CreateVideoDialog = ({ onChange={(event) => setVideoLink(event.target.value)} sx={{ mt: 3 }} /> + + {showDurationSelector && + setDuration(event.target.value)} + sx={{ mt: 3 }} + />} {showPopup && (
{ 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(""); @@ -245,6 +246,7 @@ const Project = () => { const addNewVideoHandler = async () => { const link = encodeURIComponent(videoLink.replace(/&/g, "&")); const desc = encodeURIComponent(videoDescription.replace(/&/g, "&")); + const dur = encodeURIComponent(duration); const create = true; dispatch( @@ -264,7 +266,8 @@ const Project = () => { create, voice, speakerInfo, - speakerType + speakerType, + dur ); dispatch(APITransport(apiObj)); @@ -527,6 +530,8 @@ const Project = () => { speakerInfo={speakerInfo} speakerType={speakerType} setSpeakerType={setSpeakerType} + duration={duration} + setDuration={setDuration} /> )} diff --git a/src/redux/actions/api/Project/CreateNewVideo.js b/src/redux/actions/api/Project/CreateNewVideo.js index 4e84d1ea..da726ea8 100644 --- a/src/redux/actions/api/Project/CreateNewVideo.js +++ b/src/redux/actions/api/Project/CreateNewVideo.js @@ -13,6 +13,7 @@ export default class CreateNewVideoAPI extends API { gender, speakerInfo, speakerType, + duration, timeout = 2000 ) { super("GET", timeout, false); @@ -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}`; }