Преглед на файлове

fix audio not working during development due to react's useEffect wil be triggered twice (#6126)

Lance Mao преди 10 месеца
родител
ревизия
75445a0c66
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 4 0
      web/app/components/base/voice-input/index.tsx

+ 4 - 0
web/app/components/base/voice-input/index.tsx

@@ -152,6 +152,10 @@ const VoiceInput = ({
   useEffect(() => {
     initCanvas()
     handleStartRecord()
+    const recorderRef = recorder?.current
+    return () => {
+      recorderRef?.stop()
+    }
   }, [])
 
   const minutes = parseInt(`${parseInt(`${originDuration}`) / 60}`)