Repository navigation
fix(m3u8): proxy EXT-X-MEDIA and I-frame playlist URIs - #978
Merged
Merged
Conversation
rewriteM3u8 only rewrote URI attributes on EXT-X-KEY and EXT-X-MAP, so alternate audio and subtitle renditions (EXT-X-MEDIA) and I-frame playlists in a master playlist kept their original relative URIs. The player then resolved them against /api/proxy?url=... and requested a wrong same-origin path.
metathrone
pushed a commit
to metathrone/LibreTV
that referenced
this pull request
Nov 20, 2026
fix(m3u8): proxy EXT-X-MEDIA and I-frame playlist URIs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rewriteM3u8only rewritesURI="..."attributes on#EXT-X-KEYand#EXT-X-MAP. In a master playlist, alternate audio and subtitle renditions (#EXT-X-MEDIA:...,URI="audio/en.m3u8") and I-frame playlists (#EXT-X-I-FRAME-STREAM-INF:...,URI="iframe.m3u8") keep their original URIs.Because the rewritten playlist is served from
/api/proxy?url=..., hls.js resolves a relative rendition URI against that proxy URL and requests a wrong same-origin path (for example/api/audio/en.m3u8), and an absolute one bypasses the proxy and hits CORS. Streams with separate audio groups then play without sound or fail to load.This adds
#EXT-X-MEDIA:,#EXT-X-I-FRAME-STREAM-INFand#EXT-X-SESSION-KEYto the tags whoseURIattribute is rewritten, using the same code path as KEY/MAP (already-proxied URIs are still left alone).Test: a new case in
src/lib/m3u8.test.tswith audio, subtitle and I-frame URIs fails before the change and passes after;npx vitest run src/lib/m3u8.test.tspasses (23 tests).AI assistance: I used an AI coding assistant to help find and write this fix; I reviewed the change and ran the tests.