---
title: Volume
description: Volume level and mute state for the player store
---
import UtilReference from "@/components/docs/api-reference/UtilReference.astro";
import DocsLink from "@/components/docs/DocsLink.astro";
import FrameworkCase from "@/components/docs/FrameworkCase.astro";
Controls volume level and mute state.
## State
| State | Type | Description |
|---|---|---|
| `volume` | `number` | Volume level from 0 (silent) to 1 (max) |
| `muted` | `boolean` | Whether audio is muted |
| `volumeAvailability` | `MediaFeatureAvailability` | Whether volume can be set on this platform |
## Actions
| Action | Description |
|---|---|
| `setVolume(volume)` | Set volume (clamped 0–1). Auto-unmutes when raising above zero. |
| `toggleMuted()` | Toggle mute. Restores volume to 0.25 when unmuting at zero. |
## Selector
Pass `selectVolume` to `usePlayer` to subscribe to volume state. Returns `undefined` if the volume feature is not configured.
Pass `selectVolume` to `PlayerController` to subscribe to volume state. Returns `undefined` if the volume feature is not configured.
```tsx title="VolumeSlider.tsx"
import { selectVolume, usePlayer } from '@videojs/react';
function VolumeSlider() {
const vol = usePlayer(selectVolume);
if (!vol) return null;
return (
vol.setVolume(Number(e.target.value))}
/>
);
}
```
```ts title="volume-slider.ts"
import { createPlayer, MediaElement, selectVolume } from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';
const { PlayerController, context } = createPlayer({ features: videoFeatures });
class VolumeSlider extends MediaElement {
readonly #volume = new PlayerController(this, context, selectVolume);
}
```