use-volume
Feature for managing volume level and mute state.
Installation
npx shadcn add @limeplay/use-volumeRegister the feature:
"use client"
import { volumeFeature } from "@/hooks/limeplay/use-volume"
createMediaKit({
features: [..., volumeFeature()] as const,
})Store
Access via useVolumeStore(selector):
import { useVolumeStore } from "@/hooks/limeplay/use-volume"
const level = useVolumeStore((s) => s.level)
const muted = useVolumeStore((s) => s.muted)
const setVolume = useVolumeStore((s) => s.setVolume)State
| Field | Type | Description |
|---|---|---|
level | number | Current volume (0–1) |
muted | boolean | Whether audio is muted |
hasAudio | boolean | Whether the media has audio tracks |
Actions
| Method | Description |
|---|---|
setVolume(volume, progress?, delta?) | Set volume level |
setMuted(muted) | Set mute state |
toggleMute() | Toggle mute on/off |
Setting volume to 0 automatically mutes. Unmuting from 0 restores the previous volume level.
Events
| Event | Payload | When |
|---|---|---|
volumechange | { volume, muted } | Volume or mute state changes |
mute | { muted } | Mute is toggled |
API Reference
Prop
Type