GuidePlayback
Add a quality selector
Read available renditions, let the engine adapt automatically, and offer manual quality selection.
Quality selection applies to streaming sources. A progressive MP4 plays at one fixed quality and exposes no renditions; HLS and DASH streams offer several. See Media sources.
Installation
This guide uses the hls.js media component, so install its adapter with the framework façade:
Recommended approach
Let automatic quality selection do its job by default, and offer a quality menu for users who want to pin a rendition. Render the menu only when quality selection is available.
How it works
The quality feature mirrors the media element’s video renditions into player state:
videoRenditionListholds each rendition’sid,width,height,bitrate,frameRate,codec, and whether it’sselected.activeVideoRenditionis the rendition currently playing. When the engine doesn’t report one directly, the player matches it from the video’s current dimensions.selectVideoRendition(value)pins one rendition; pass'auto'to return control to the engine’s adaptive selection.
<media-quality-radio-group> turns this state into a ready-made radio menu with resolution labels and an “Auto” entry, as the example above shows.
Selecting “Auto” keeps adaptive bitrate switching active: the engine picks the best rendition for current bandwidth and viewport. Pinning a rendition disables adaptation until the user selects “Auto” again.
Availability and constraints
- Quality availability is
'unavailable'for media that doesn’t offer a choice — progressive files, streams before the manifest loads, and single-rendition streams. Render quality UI conditionally on that value. - Renditions come from the streaming engine, so the list depends on what the manifest declares. A single-rendition stream offers no meaningful selection, so availability stays
'unavailable'. - Pinning a high rendition on a slow connection causes buffering: the engine can no longer step down. Keep “Auto” the default.
- Rendition lists change on source change; selection resets with them.
Common variations
Auto quality only
If you don’t want to expose manual selection, do nothing: adaptive selection is on by default and needs no UI.
Cap or pin quality programmatically
Access the player store through the player controller and call selectVideoRendition with a rendition id from videoRenditionList, or 'auto' to restore adaptive selection.
Troubleshooting
The quality menu doesn’t render
Quality availability is 'unavailable'. The source is progressive (no renditions), the manifest hasn’t loaded yet, or the media element doesn’t support renditions. Use a streaming media element such as <hls-video> or <hlsjs-video>.
The menu doesn’t render for a single-rendition stream
The manifest declares a single rendition, so quality availability stays 'unavailable' — one entry offers no choice. Encode the stream as a multi-rendition ladder to give the engine and users something to choose between.
Playback buffers after selecting a quality
The pinned rendition exceeds available bandwidth. Selecting “Auto” lets the engine step down again.