Spaces:
Running
Running
Download apps/web/src/components/livekit/AudioMeter.tsx from Benaah/MicProtocol: direct link, hf CLI and curl.
- Browser
- Download file 637 Bytes
-
https://huggingface.co/spaces/Benaah/MicProtocol/resolve/main/apps/web/src/components/livekit/AudioMeter.tsx
- Command line
-
hf download hf://spaces/Benaah/MicProtocol/apps/web/src/components/livekit/AudioMeter.tsx
-
curl -L -o AudioMeter.tsx https://huggingface.co/spaces/Benaah/MicProtocol/resolve/main/apps/web/src/components/livekit/AudioMeter.tsx
637 Bytes
| "use client"; | |
| import { useLocalParticipant, useTrackVolume } from "@livekit/components-react"; | |
| interface AudioMeterProps { | |
| participantIdentity?: string; | |
| } | |
| export function AudioMeter({ participantIdentity }: AudioMeterProps) { | |
| const { localParticipant, microphoneTrack } = useLocalParticipant(); | |
| const track = microphoneTrack?.track; | |
| const volume = useTrackVolume(track as any); | |
| return ( | |
| <div className="h-2 w-full bg-muted rounded-full overflow-hidden"> | |
| <div | |
| className={`h-full bg-primary transition-all duration-100`} | |
| style={{ width: `${Math.max(volume * 100, 0)}%` }} | |
| /> | |
| </div> | |
| ); | |
| } | |