Volume
Volume level and mute state for the player store
Controls volume level and mute state.
API Reference
State
| Property | Type | Details |
|---|---|---|
volume | number | |
| ||
muted | boolean | |
| ||
volumeAvailability | 'available' | 'unavailable' | 'unsupported' | |
| ||
Actions
| Action | Type | Details |
|---|---|---|
setVolume | (volume: number) => number | |
| ||
toggleMuted | () => boolean | |
| ||
Selector
Pass selectVolume to PlayerController to subscribe to volume state. Returns undefined if the volume feature is not configured.
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);
}