transcriber-01
elevenlabs/transcriber-01FreeBlock
Transcriber
Install it
npx shadcn@latest add https://raw.githubusercontent.com/elevenlabs/ui/main/apps/www/public/r/transcriber-01.jsonSource
1"use client"23import { Fragment, useCallback, useEffect, useRef, useState } from "react"4import { Copy } from "lucide-react"5import { Streamdown } from "streamdown"67import { cn } from "@/lib/utils"8import {9 transcribeAudio,10 type TranscriptionResult,11} from "@/app/transcriber-01/actions/transcribe"12import { Button } from "@/components/ui/button"13import { Card } from "@/components/ui/card"14import { LiveWaveform } from "@/components/ui/live-waveform"15import { ScrollArea } from "@/components/ui/scroll-area"16import { Separator } from "@/components/ui/separator"1718interface RecordingState {19 isRecording: boolean20 isProcessing: boolean21 transcript: string22 error: string23 transcriptionTime?: number24}2526export default function Transcriber01() {27 const [recording, setRecording] = useState<RecordingState>({28 isRecording: false,29 isProcessing: false,30 transcript: "",31 error: "",32 })3334 const mediaRecorderRef = useRef<MediaRecorder | null>(null)35 const audioChunksRef = useRef<Blob[]>([])36 const streamRef = useRef<MediaStream | null>(null)3738 const updateRecording = useCallback((updates: Partial<RecordingState>) => {39 setRecording((prev) => ({ ...prev, ...updates }))40 }, [])4142 const cleanupStream = useCallback(() => {43 if (streamRef.current) {44 streamRef.current.getTracks().forEach((track) => track.stop())45 streamRef.current = null46 }47 }, [])4849 const stopRecording = useCallback(() => {50 if (mediaRecorderRef.current?.state !== "inactive") {51 mediaRecorderRef.current?.stop()52 }53 cleanupStream()54 updateRecording({ isRecording: false })55 }, [cleanupStream, updateRecording])5657 const processAudio = useCallback(58 async (audioBlob: Blob) => {59 updateRecording({ isProcessing: true, error: "" })6061 try {62 const result: TranscriptionResult = await transcribeAudio({63 audio: new File([audioBlob], "recording.webm", {64 type: "audio/webm",65 }),66 })6768 if (result.error) {69 throw new Error(result.error)70 }7172 updateRecording({73 transcript: result.text || "",74 transcriptionTime: result.transcriptionTime,75 isProcessing: false,76 })77 } catch (err) {78 console.error("Transcription error:", err)79 updateRecording({80 error:81 err instanceof Error ? err.message : "Failed to transcribe audio",82 isProcessing: false,83 })84 }85 },86 [updateRecording]87 )8889// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from shadcn/ui
All 50 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| music-player-01music-player-01 | shadcn/ui | Blocks | Free | no deps | |
| music-player-02music-player-02 | shadcn/ui | Blocks | Free | no deps | |
| pong-01pong-01 | shadcn/ui | Blocks | Free | 1 dep · 6 files | |
| realtime-transcriber-01realtime-transcriber-01 | shadcn/ui | Blocks | Free | 2 deps · 3 files | |
| speaker-01speaker-01 | shadcn/ui | Blocks | Free | no deps · 2 files | |
| voice-chat-01voice-chat-01 | shadcn/ui | Blocks | Free | 1 dep | |
| voice-chat-02voice-chat-02 | shadcn/ui | Blocks | Free | 2 deps | |
| voice-chat-03voice-chat-03 | shadcn/ui | Blocks | Free | 1 dep |
