Skip to content

[Bug]: "Auto" quality option is missing from the player quality menu, and auto quality wrongly selects 4K on mobile devices #407

Open

Description

@Aquarius-Situla

What happened?

When configuring playback quality, I noticed two related issues regarding "Auto" quality:

  1. "Auto" option is missing in the player menu:
    In the on-screen player quality selector (QualitySelector), only fixed resolution tiers (2160p, 1440p, 1080p, 720p, etc.) are available. There is no "Auto" option to allow the player to adaptively select resolution on the fly.
  2. "Auto" default setting incorrectly resolves to 4K on mobile phones:
    When setting default quality to "Auto" in Playback Settings, the player immediately pulls 4K (2160p) on a mobile phone (e.g. iPhone).

Steps to reproduce

  1. In Settings -> Playback, set the default video quality to "Auto".
  2. Open any video on a mobile phone (e.g. an iPhone with devicePixelRatio = 3).
  3. Observe that the player loads the 4K (2160p) stream, causing high bandwidth consumption and device heating.
  4. Open the in-player quality menu: notice there is no "Auto" option available to re-enable adaptive switching.

Area

Frontend (web app)

Channel

beta

Anything else?

Root Cause Analysis

  1. "Auto" explicitly filtered out in QualitySelector:
    In apps/web/src/components/quality-selector.tsx:

    • For standard/Vidstack streams, line 36 explicitly skips the auto option:
      for (const option of options) {
        if (option.quality === null) continue; // Vidstack's Auto option has quality === null
    • For SABR streams, sabrResolutionOptions only maps concrete format itags without providing an "Auto" selection entry.
  2. Screen height calculation bug in automaticSabrQuality:
    In apps/web/src/lib/sabr-source.ts:

    export function automaticSabrQuality(screenHeight: number, devicePixelRatio: number, ...): string {
      const physicalHeight = Math.max(360, screenHeight * Math.max(1, devicePixelRatio));
      const height = [2160, 1440, 1080, 720, 480, 360].find((candidate) => candidate <= physicalHeight);
      return `${height ?? 360}p`;
    }

    On a mobile phone in portrait orientation (e.g. iPhone with screen height 844 pt and DPR 3):

    • physicalHeight evaluates to 844 * 3 = 2532px.
    • Since 2160 <= 2532, the algorithm picks 2160p (4K).
    • For standard 16:9 landscape videos on phones, the limiting resolution is the screen width (Math.min(screenWidth, screenHeight) * DPR ≈ 1170px), which should cap at 1080p rather than 4K.

Proposed Fix

  1. Provide "Auto" in QualitySelector: Keep the Auto option in collectResolutionOptions and add an Auto option for SABR playback so users can switch back to adaptive mode from the player menu.
  2. Fix automaticSabrQuality mobile dimension: Use Math.min(window.screen.width, window.screen.height) * devicePixelRatio (or explicitly cap mobile phone viewports at 1080p/1440p) so phones do not inadvertently select 4K.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions