Skip to content

vhs-json: initial ABR playlist selection is overridden, and paused players don't pre-buffer #1608

Description

@kpoojari-li

Description

Two related bugs affect vhs-json (pre-resolved manifest object) sources:

  1. Initial ABR selection is discarded. When a vhs-json main playlist has multiple resolved variants, the variant chosen during the first loadedplaylist is silently overridden back to playlists[0]. In PlaylistLoader.setupInitialPlaylist, the fallback guard is if (!this.request). For vhs-json, media() resolves via a fast path that sets this.media_ without issuing an XHR, so this.request is never set — the guard is always true and resets the selection.

  2. Paused players never pre-buffer. For vhs-json, PlaylistLoader.media() fires loadedmetadata synchronously; the segment loader starts, then handleUpdatedMediaPlaylist pauses it and only restarts when the tech is playing. A paused player with preload="auto" therefore downloads no segments (TTFF regression on play).

Sources

Reproducible with any vhs-json source whose main playlist has two or more resolved variants.

Note: this is hard to surface with the project's own demo page as-is, because the bundled demo manifest (scripts/dash-manifest-object.json) has only a single playlist. With one variant the playlists[0] override is a no-op — there is no alternative for ABR to select — so the bug stays invisible. Using a multi-variant resolved manifest is what makes both issues observable.

Steps to reproduce

  1. Load a vhs-json source with ≥2 resolved variants where ABR should pick a variant other than index 0.
  2. Observe the player plays playlists[0] regardless of the ABR choice.
  3. With preload="auto" on a paused player, observe no segment requests in the Network tab until play.

Results

  • Expected: honor the ABR-selected variant, and pre-buffer for VoD when preload permits.
  • Actual: always playlists[0]; no pre-buffer while paused.

Demonstration

Network throttled to 3G. The player first downloads bbb_30fps_1920x1080_8000k (playlists[0], ~9.9 Mbps) — the wrong rendition for a slow link — because the playlists[0] override discards ABR's initial selection. Only on the next ABR cycle does it correct down to bbb_30fps_320x180_200k (playlists[1], ~254 Kbps). The result is a wasted high-bitrate segment fetch and delayed startup on constrained connections.

issue-compressed.mp4
Image Image

Additional Information

  • videojs-http-streaming 3.17.4
  • video.js 8.19.x
  • Browsers affected: Chrome (all platforms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions