The FastPix Player exposes a JavaScript API for reading and switching video quality levels, which lets you build a branded quality selector that gives viewers explicit resolution control while preserving adaptive bitrate (ABR) fallback for unstable networks. Combine the quality methods with slot-based overlays to position your custom UI directly over the video without managing absolute positioning yourself.
playbackId is the access-controlled identifier FastPix assigns for constructing the HLS playback URL: https://stream.fastpix.com/{PLAYBACK_ID}.m3u8.Call player.getQualityLevels() after the manifest loads to get the full rendition ladder.
Each entry contains:
NOTE
The array is empty for audio-only streams or single-rendition videos. Wait for the
fastpixqualitylevelsreadyevent before calling this method on a new video.
Call player.setQualityLevel(id) to disable ABR and force the player to use one rendition.
The id value comes from a getQualityLevels() entry. Do not hard-code IDs across videos — each manifest generates its own ID set.
Call player.setQualityAuto() to hand control back to the ABR engine. The player resumes switching renditions based on network conditions.
Use this when the viewer selects “Auto” in your menu, or as a fallback after a quality error.
Call player.getPlaybackQuality() to get a snapshot of the player’s current quality mode and active rendition.
NOTE
loadedLevelreflects what is actually on screen. Under ABR, it can differ fromlockedLevelbriefly during a rendition switch.
The player triggers three custom events on the <fastpix-player> element. Listen with addEventListener.
fastpixqualitylevelsreadyTriggers when the HLS manifest is parsed and quality levels are available. Also triggers again if a new video loads.
event.detail contains:
fastpixqualitychangeTriggers whenever the quality state changes, either from a viewer action (setQualityLevel / setQualityAuto) or from ABR switching renditions automatically.
event.detail contains:
fastpixqualityfailedTriggers when a quality change fails — either when an invalid ID is passed to setQualityLevel(), or when a specific rendition fails to load from the network.
event.detail contains:
A complete, working quality selector combining every API and event described in this guide. The example uses slot overlays to position the menu in the top-right corner of the video. Copy the HTML below, replace your-playback-id with a real playbackId, and open it in a browser.
<fastpix-player> is createdfastpixqualitylevelsready triggersgetQualityLevels() and builds quality buttonssetQualityLevel(id)fastpixqualitychange triggersgetPlaybackQuality() and highlights the active buttonsetQualityAuto()fastpixqualitychange triggers again → UI updatesDo quality level IDs stay the same across different videos?
No. Each video’s HLS manifest generates its own rendition ladder with unique IDs. Always call getQualityLevels() after fastpixqualitylevelsready triggers for the current video. Do not cache IDs from one video and reuse them on another.
What happens if the video has only one rendition?
getQualityLevels() returns an empty array. The player uses the single available rendition and ABR has no alternatives to switch between. Hide or disable your quality menu in this case.
Can I set a default quality lock before the video starts?
Listen for fastpixqualitylevelsready, find the rendition you want by label or height, and call setQualityLevel(id) immediately. The player applies the lock before the first segment plays at the ABR-selected level.
How do I show the currently active quality in the menu without polling?
Listen for fastpixqualitychange — it triggers on every ABR switch and every manual selection. Call getPlaybackQuality() inside the handler and update your UI. No polling or timers are needed.