diff --git a/src/App.jsx b/src/App.jsx index 96f331a..948a131 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -254,18 +254,23 @@ Teacher: Good job! How about Magic – something special and powerful. }); }; - const toggleRecording = () => { - if (!isRecording) { - audioChunksRef.current = []; - mediaRecorderRef.current.start(); - setIsRecording(true); - monitorSilence(); - } else { + const startRecording = () => { + if (!isRecording && mediaRecorderRef.current) { + audioChunksRef.current = []; + mediaRecorderRef.current.start(); + setIsRecording(true); + monitorSilence(); + } + }; + + const stopRecording = () => { + if (isRecording && mediaRecorderRef.current) { mediaRecorderRef.current.stop(); setIsRecording(false); } }; + return (
@@ -299,10 +304,14 @@ Teacher: Good job! How about Magic – something special and powerful.