npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pipecat-ai/client-react

v1.1.0

Published

<h1><div align="center"> <img alt="pipecat react" width="500px" height="auto" src="https://raw.githubusercontent.com/pipecat-ai/pipecat-client-web/main/pipecat-react.png"> </div></h1>

Readme

Docs NPM Version

Install

npm install @pipecat-ai/client-js @pipecat-ai/client-react

Quick Start

Instantiate a PipecatClient instance and pass it down to the PipecatClientProvider. Render the <PipecatClientAudio> component to have audio output setup automatically.

import { PipecatClient } from "@pipecat-ai/client-js";
import { PipecatClientAudio, PipecatClientProvider } from "@pipecat-ai/client-react";

const client = new PipecatClient({
  transport: myTransportType.create(),
});

render(
  <PipecatClientProvider client={client}>
    <MyApp />
    <PipecatClientAudio />
  </PipecatClientProvider>
);

We recommend starting the voiceClient from a click of a button, so here's a minimal implementation of <MyApp> to get started:

import { usePipecatClient } from "@pipecat-ai/client-react";

const MyApp = () => {
  const client = usePipecatClient();
  return <button onClick={() => client.start()}>OK Computer</button>;
};

Components

PipecatClientProvider

The root component for providing Pipecat client context to your application.

Props

  • client (PipecatClient, required): A singleton instance of PipecatClient.
<PipecatClientProvider client={pcClient}>
  {/* Child components */}
</PipecatClientProvider>

PipecatClientAudio

Creates a new <audio> element that mounts the bot's audio track.

Props

No props

<PipecatClientAudio />

PipecatClientVideo

Creates a new <video> element that renders either the bot or local participant's video track.

Props

  • participant ("local" | "bot"): Defines which participant's video track is rendered
  • fit ("contain" | "cover", optional): Defines whether the video should be fully contained or cover the box. Default: 'contain'.
  • mirror (boolean, optional): Forces the video to be mirrored, if set.
  • onResize(dimensions: object) (function, optional): Triggered whenever the video's rendered width or height changes. Returns the video's native width, height and aspectRatio.
<PipecatClientVideo
  participant="local"
  fit="cover"
  mirror
  onResize={({ aspectRatio, height, width }) => {
    console.log("Video dimensions changed:", { aspectRatio, height, width });
  }}
/>

PipecatClientCamToggle

This is a stateful headless component and exposes the user's camEnabled state and an onClick handler to toggle the state.

Props

  • onCamEnabledChanged(enabled: boolean) (function, optional): Triggered when the user's camEnabled state changes
  • disabled (boolean, optional): Disables the cam toggle
<PipecatClientCamToggle>
  {({ disabled, isCamEnabled, onClick }) => (
    <button disabled={disabled} onClick={onClick}>
      {isCamEnabled ? "Turn off" : "Turn on"} camera
    </button>
  )}
</PipecatClientCamToggle>

PipecatClientMicToggle

This is a stateful headless component and exposes the user's micEnabled state and an onClick handler to toggle the state.

Props

  • onMicEnabledChanged(enabled: boolean) (function, optional): Triggered when the user's micEnabled state changes
  • disabled (boolean, optional): Disables the mic toggle
<PipecatClientMicToggle>
  {({ disabled, isMicEnabled, onClick }) => (
    <button disabled={disabled} onClick={onClick}>
      {isMicEnabled ? "Mute" : "Unmute"} microphone
    </button>
  )}
</PipecatClientMicToggle>

VoiceVisualizer

Renders a visual representation of audio input levels on a <canvas> element. The visualization consists of vertical bars.

Props

  • participantType (string, required): The participant type to visualize audio for.
  • backgroundColor (string, optional): The background color of the canvas. Default: 'transparent'.
  • barColor (string, optional): The color of the audio level bars. Default: 'black'.
  • barCount (number, optional): The amount of bars to render. Default: 5
  • barGap (number, optional): The gap between bars in pixels. Default: 12.
  • barLineCap ('round' | 'square', optional): The line cap for each bar. Default: 'round'
  • barOrigin ('bottom' | 'center' | 'top', optional): The origin from where the bars grow to full height. Default: 'center'
  • barWidth (number, optional): The width of each bar in pixels. Default: 30.
  • barMaxHeight (number, optional): The maximum height at full volume of each bar in pixels. Default: 120.
<VoiceVisualizer
  participantType="local"
  backgroundColor="white"
  barColor="black"
  barGap={1}
  barWidth={4}
  barMaxHeight={24}
/>

Hooks

usePipecatClient

Provides access to the PipecatClient instance originally passed to PipecatClientProvider.

import { usePipecatClient } from "@pipecat-ai/client-react";

function MyComponent() {
  const pcClient = usePipecatClient();
}

useRTVIClientEvent

Allows subscribing to RTVI events. It is advised to wrap handlers with useCallback.

Arguments

  • event (RTVIEvent, required)
  • handler (function, required)
import { useCallback } from "react";
import { RTVIEvent, TransportState } from "@pipecat-ai/client-js";
import { useRTVIClientEvent } from "@pipecat-ai/client-react";

function EventListener() {
  useRTVIClientEvent(
    RTVIEvent.TransportStateChanged,
    useCallback((transportState: TransportState) => {
      console.log("Transport state changed to", transportState);
    }, [])
  );
}

usePipecatClientCamControl

Allows to control the user's camera state.

import { usePipecatClientCamControl } from "@pipecat-ai/client-react";

function CustomCamToggle() {
  const { enableCam, isCamEnabled } = usePipecatClientCamControl();
}

usePipecatClientMicControl

Allows to control the user's microphone state.

import { usePipecatClientMicControl } from "@pipecat-ai/client-react";

function CustomMicToggle() {
  const { enableMic, isMicEnabled } = usePipecatClientMicControl();
}

usePipecatClientMediaDevices

Manage and list available media devices.

import { usePipecatClientMediaDevices } from "@pipecat-ai/client-react";

function DeviceSelector() {
  const {
    availableCams,
    availableMics,
    selectedCam,
    selectedMic,
    updateCam,
    updateMic,
  } = usePipecatClientMediaDevices();

  return (
    <>
      <select
        name="cam"
        onChange={(ev) => updateCam(ev.target.value)}
        value={selectedCam?.deviceId}
      >
        {availableCams.map((cam) => (
          <option key={cam.deviceId} value={cam.deviceId}>
            {cam.label}
          </option>
        ))}
      </select>
      <select
        name="mic"
        onChange={(ev) => updateMic(ev.target.value)}
        value={selectedMic?.deviceId}
      >
        {availableMics.map((mic) => (
          <option key={mic.deviceId} value={mic.deviceId}>
            {mic.label}
          </option>
        ))}
      </select>
    </>
  );
}

usePipecatClientMediaTrack

Access audio and video tracks.

Arguments

  • trackType ("audio" | "video", required)
  • participantType ("bot" | "local", required)
import { usePipecatClientMediaTrack } from "@pipecat-ai/client-react";

function MyTracks() {
  const localAudioTrack = usePipecatClientMediaTrack("audio", "local");
  const botAudioTrack = usePipecatClientMediaTrack("audio", "bot");
}

usePipecatClientTransportState

Returns the current transport state.

import { usePipecatClientTransportState } from "@pipecat-ai/client-react";

function ConnectionStatus() {
  const transportState = usePipecatClientTransportState();
}