Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
stop the screen sharing stream after it's recording is done
Abi Raja4e30b207c1ee
diff --git a/frontend/src/components/recording/ScreenRecorder.tsx b/frontend/src/components/recording/ScreenRecorder.tsxindex c2cc06dc..4e8060a4 100644--- a/frontend/src/components/recording/ScreenRecorder.tsx+++ b/frontend/src/components/recording/ScreenRecorder.tsx@@ -19,6 +19,7 @@ function ScreenRecorder({setScreenRecorderState,generateCode,}: Props) {+ const [mediaStream, setMediaStream] = useState<MediaStream | null>(null);const [mediaRecorder, setMediaRecorder] = useState<MediaRecorder | null>(null);@@ -33,6 +34,7 @@ function ScreenRecorder({video: true,audio: { echoCancellation: true },});+ setMediaStream(stream);// TODO: Test across different browsers// Create the media recorder@@ -55,6 +57,7 @@ function ScreenRecorder({);const dataUrl = await blobToBase64DataUrl(completeBlob);+setScreenRecordingDataUrl(dataUrl);setScreenRecorderState(ScreenRecorderState.FINISHED);};@@ -69,10 +72,18 @@ function ScreenRecorder({};const stopScreenRecording = () => {+ // Stop the recorderif (mediaRecorder) {mediaRecorder.stop();setMediaRecorder(null);}++ // Stop the screen sharing stream+ if (mediaStream) {+ mediaStream.getTracks().forEach((track) => {+ track.stop();+ });+ }};const kickoffGeneration = () => {