Limeplay - Open Source Video Player UI ComponentsLimeplay

Mute Control

Toggle button for muting/unmuting media audio.

Installation

npx shadcn add @limeplay/mute-control

Requires volumeFeature registered in your createMediaKit.

Usage

components/player/mute-button.tsx
import {
  SpeakerHighIcon,
  SpeakerLowIcon,
  SpeakerXIcon,
} from "@phosphor-icons/react"

import { Button } from "@/components/ui/button"
import { useVolumeStore } from "@/hooks/limeplay/use-volume"
import { MuteControl } from "@/components/limeplay/mute-control"

export function MuteButton() {
  const muted = useVolumeStore((s) => s.muted)
  const level = useVolumeStore((s) => s.level)

  return (
    <MuteControl asChild>
      <Button variant="ghost" size="icon">
        {muted || level === 0 ? (
          <SpeakerXIcon size={18} weight="fill" />
        ) : level < 0.5 ? (
          <SpeakerLowIcon size={18} weight="fill" />
        ) : (
          <SpeakerHighIcon size={18} weight="fill" />
        )}
      </Button>
    </MuteControl>
  )
}

The MuteControl component calls toggleMute() on click. Supports asChild for custom button rendering.

On this page