From 58bd381c0917e8a5e9eb80737ff4e0fd151267b7 Mon Sep 17 00:00:00 2001 From: kartikvirendrar Date: Thu, 29 Feb 2024 21:50:02 +0530 Subject: [PATCH] set default player for audio files above 700 seconds to wavesurfer --- .../AllAudioTranscriptionLandingPage.jsx | 9 +++++++-- .../CL-Transcription/AudioTranscriptionLandingPage.jsx | 9 +++++++-- .../ReviewAudioTranscriptionLandingPage.jsx | 9 +++++++-- .../SuperCheckerAudioTranscriptionLandingPage.jsx | 9 +++++++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/ui/pages/container/CL-Transcription/AllAudioTranscriptionLandingPage.jsx b/src/ui/pages/container/CL-Transcription/AllAudioTranscriptionLandingPage.jsx index 04acb6e99..fed12b78e 100644 --- a/src/ui/pages/container/CL-Transcription/AllAudioTranscriptionLandingPage.jsx +++ b/src/ui/pages/container/CL-Transcription/AllAudioTranscriptionLandingPage.jsx @@ -83,6 +83,7 @@ const AllAudioTranscriptionLandingPage = () => { const getNextTask = useSelector((state) => state.getnextProject?.data); const [advancedWaveformSettings, setAdvancedWaveformSettings] = useState(false); const [assignedUsers, setAssignedUsers] = useState(null); + const [waveSurfer, setWaveSurfer] = useState(true); const handleCollapseClick = () => { !showNotes && setShowStdTranscript(false); @@ -111,7 +112,12 @@ const AllAudioTranscriptionLandingPage = () => { variant: "error", }); } else { - setTaskData(resp) + setTaskData(resp); + if (resp?.data?.audio_duration < 700){ + setWaveSurfer(false); + }else{ + setWaveSurfer(true); + } } setLoading(false); }; @@ -334,7 +340,6 @@ const AllAudioTranscriptionLandingPage = () => { }) }, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]); - const [waveSurfer, setWaveSurfer] = useState(true); const [waveSurferHeight, setWaveSurferHeigth] = useState(140); const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100); const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00'); diff --git a/src/ui/pages/container/CL-Transcription/AudioTranscriptionLandingPage.jsx b/src/ui/pages/container/CL-Transcription/AudioTranscriptionLandingPage.jsx index 46b5bd6de..2a416fc58 100644 --- a/src/ui/pages/container/CL-Transcription/AudioTranscriptionLandingPage.jsx +++ b/src/ui/pages/container/CL-Transcription/AudioTranscriptionLandingPage.jsx @@ -111,6 +111,7 @@ const AudioTranscriptionLandingPage = () => { const [assignedUsers, setAssignedUsers] = useState(null); const [autoSave, setAutoSave] = useState(true); const [autoSaveTrigger, setAutoSaveTrigger] = useState(false); + const [waveSurfer, setWaveSurfer] = useState(true); // useEffect(() => { // let intervalId; @@ -286,7 +287,12 @@ const AudioTranscriptionLandingPage = () => { variant: "error", }); } else { - setTaskData(resp) + setTaskData(resp); + if (resp?.data?.audio_duration < 700){ + setWaveSurfer(false); + }else{ + setWaveSurfer(true); + } } setLoading(false); }; @@ -793,7 +799,6 @@ useEffect(() => { }) }, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]); -const [waveSurfer, setWaveSurfer] = useState(true); const [waveSurferHeight, setWaveSurferHeigth] = useState(140); const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100); const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00'); diff --git a/src/ui/pages/container/CL-Transcription/ReviewAudioTranscriptionLandingPage.jsx b/src/ui/pages/container/CL-Transcription/ReviewAudioTranscriptionLandingPage.jsx index 92f7680bb..6d28ee639 100644 --- a/src/ui/pages/container/CL-Transcription/ReviewAudioTranscriptionLandingPage.jsx +++ b/src/ui/pages/container/CL-Transcription/ReviewAudioTranscriptionLandingPage.jsx @@ -115,6 +115,7 @@ const ReviewAudioTranscriptionLandingPage = () => { const [assignedUsers, setAssignedUsers] = useState(null); const [autoSave, setAutoSave] = useState(true); const [autoSaveTrigger, setAutoSaveTrigger] = useState(false); + const [waveSurfer, setWaveSurfer] = useState(true); // useEffect(() => { // let intervalId; @@ -302,7 +303,12 @@ const ReviewAudioTranscriptionLandingPage = () => { message: "Audio Server is down, please try after sometime", variant: "error", }); - }else(setTaskDetailList(resp)) + }else{setTaskDetailList(resp); + if (resp?.data?.audio_duration < 700){ + setWaveSurfer(false); + }else{ + setWaveSurfer(true); + }} setLoading(false); }; @@ -990,7 +996,6 @@ useEffect(() => { }) }, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]); -const [waveSurfer, setWaveSurfer] = useState(true); const [waveSurferHeight, setWaveSurferHeigth] = useState(140); const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100); const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00'); diff --git a/src/ui/pages/container/CL-Transcription/SuperCheckerAudioTranscriptionLandingPage.jsx b/src/ui/pages/container/CL-Transcription/SuperCheckerAudioTranscriptionLandingPage.jsx index d2bb9d3d9..4e2947982 100644 --- a/src/ui/pages/container/CL-Transcription/SuperCheckerAudioTranscriptionLandingPage.jsx +++ b/src/ui/pages/container/CL-Transcription/SuperCheckerAudioTranscriptionLandingPage.jsx @@ -113,6 +113,7 @@ const SuperCheckerAudioTranscriptionLandingPage = () => { const [assignedUsers, setAssignedUsers] = useState(null); const [autoSave, setAutoSave] = useState(true); const [autoSaveTrigger, setAutoSaveTrigger] = useState(false); + const [waveSurfer, setWaveSurfer] = useState(true); // useEffect(() => { // let intervalId; @@ -223,7 +224,12 @@ const SuperCheckerAudioTranscriptionLandingPage = () => { message: "Audio Server is down, please try after sometime", variant: "error", }); - }else{setTaskDetailList(resp)} + }else{setTaskDetailList(resp); + if (resp?.data?.audio_duration < 700){ + setWaveSurfer(false); + }else{ + setWaveSurfer(true); + }} setLoading(false); }; @@ -838,7 +844,6 @@ useEffect(() => { }) }, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]); -const [waveSurfer, setWaveSurfer] = useState(true); const [waveSurferHeight, setWaveSurferHeigth] = useState(140); const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100); const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00');