Skip to content

Instantly share code, notes, and snippets.

View lorenasg1's full-sized avatar
🏠
Working from home

Lorena Sabino Guedes lorenasg1

🏠
Working from home
  • Flash
  • Brasil
View GitHub Profile
@cassidoo
cassidoo / simple-react-recorder.jsx
Last active November 15, 2024 07:09
A simple React microphone component, recording audio and showing the blob in the browser, styled with Tailwind.
"use client";
import { useState, useEffect, useRef } from "react";
function SimpleRecordButton() {
const [isRecording, setIsRecording] = useState(false);
const [audioStream, setAudioStream] = useState(null);
const [mediaRecorder, setMediaRecorder] = useState(null);
const [audioBlob, setAudioBlob] = useState(null);
const [recordingTime, setRecordingTime] = useState(0);
const timerRef = useRef(null);