hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

Support switching alternate video renditions (as you do for audio)

Open danihorvath opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

Hls.js currently supports alternate renditions for audio (TYPE=AUDIO) and subtitles (TYPE=SUBTITLES) as defined in the HLS spec. However, alternate video renditions (TYPE=VIDEO) are not supported. This prevents users from switching between multiple camera angles or video streams when they are defined in the manifest.

Describe the solution you'd like

I would like Hls.js to support the #EXT-X-MEDIA:TYPE=VIDEO tag, in the same way it already does for audio and subtitle tracks. Specifically:

  • Expose video tracks in the API, similar to audio tracks.
  • Provide the ability to programmatically select a video track at runtime.
  • Keep the existing levels feature (bitrate/quality switching) available within each video track, so users can still benefit from adaptive bitrate streaming for every video angle.

Additional context

The HLS specification explicitly defines support for alternate video tracks: https://developer.apple.com/documentation/http-live-streaming/adding-alternate-media-to-a-playlist

For a practical example, I have created the following stream, which includes multiple video tracks: https://danihorvath.github.io/hls-multivideo/master.m3u8

I found a related issue (hls.js #1825), but it has been closed.

danihorvath avatar Sep 11 '25 07:09 danihorvath

Ideally, level-controller would create the alternate variants (Level[]) expose a method for switching (emit LEVELS_UPDATED), with variant filtering based on the active video group.

Understanding the audio-track and content-steering controllers and how to apply what they do to level-controller is a good start. content-steering replaces Level[] based on Pathways by emitting LEVELS_UPDATED. The audio-track controller has some group management and selection logic that is relevant, but not so much that it could be copied.

robwalch avatar Mar 10 '26 17:03 robwalch