Skip to main content
You are currently viewing the React version of this page. Use the dropdown to the right to customize this page for your client framework.
The Pipecat client handles media at two levels: local devices (the user’s mic, camera, and speakers) and media tracks (the live audio/video streams flowing between client and bot). This page covers how to work with both.

Bot audio output

Drop PipecatClientAudio inside your PipecatClientProvider and it handles everything — it mounts a hidden <audio> element and wires up the bot’s audio track automatically:
No props required. Just make sure it lives inside the provider.

Microphone

Enabling and muting

Set enableMic: true in the constructor to start the session with the mic active. This is the default:
Use usePipecatClientMicControl to mute and unmute within a component:
Or use the headless PipecatClientMicToggle component, which provides the same state via a render prop.

Switching microphones

usePipecatClientMediaDevices gives you a reactive device list and setters:

Camera

Camera is disabled by default. Enable it in the constructor:
Not all transports support video. enableCam has no effect on transports that don’t support it (e.g. WebSocket).
Use usePipecatClientCamControl to toggle the camera, and PipecatClientVideo to render the feed:
Use participant="bot" to render the bot’s video feed instead. Switch cameras via availableCams / updateCam from usePipecatClientMediaDevices.

Speakers

Enumerate and switch output devices via usePipecatClientMediaDevices:

Device initialization before connecting

By default, device access is requested when connect() is called. If you want to enumerate or test devices before the session starts — for example, to show a device picker pre-call — call initDevices() first:

Media tracks

For advanced use cases — custom rendering, audio processing, recording — you can access the raw MediaStreamTrack objects directly.
Use usePipecatClientMediaTrack:

Audio visualization

The React SDK includes VoiceVisualizer, a canvas-based component that renders audio level bars for any participant:
Set participantType="bot" to visualize the bot’s audio instead.

API reference

Client Methods — Devices

initDevices, getAllMics, enableMic, and more

React Hooks

usePipecatClientMediaDevices, usePipecatClientMicControl, usePipecatClientCamControl, usePipecatClientMediaTrack

React Components

PipecatClientAudio, PipecatClientVideo, PipecatClientMicToggle, PipecatClientCamToggle, VoiceVisualizer