Skip to content

Support URI resolution for PDT between ExtInf and URI#46

Closed
Baraujo25 wants to merge 2 commits into
developmentfrom
HLS_URI_RESOLUTION
Closed

Support URI resolution for PDT between ExtInf and URI#46
Baraujo25 wants to merge 2 commits into
developmentfrom
HLS_URI_RESOLUTION

Conversation

@Baraujo25

Copy link
Copy Markdown
Collaborator

This pull request improves the robustness of HLS playlist parsing by handling cases where the segment URI is missing due to the presence of tags (such as #EXT-X-PROGRAM-DATE-TIME) between #EXTINF and the segment URI. It introduces a fallback mechanism to extract segment URIs directly from the playlist body when the parser fails, and adds comprehensive tests to verify correct behavior for various playlist structures.

HLS Playlist Parsing Robustness:

  • Enhanced the Playlist.getMediaSegments() method to detect when segment URIs are missing (e.g., due to #EXT-X-PROGRAM-DATE-TIME between #EXTINF and the URI) and to extract URIs directly from the playlist body as a fallback, ensuring segments are resolved correctly in non-standard playlist layouts.
  • Added helper methods requiresSegmentUriFallback and extractSegmentUrisFromBody to support the new fallback logic for segment URI extraction.
  • Updated imports to include ExtInf, which is now used directly in the fallback logic.

Testing Improvements:

  • Added a new test class PlaylistTest with scenarios covering playlists where #EXT-X-PROGRAM-DATE-TIME appears before or between #EXTINF and segment URIs, as well as standard playlists, to ensure correct segment URI resolution in all cases.
  • Extended HlsSamplerTest to include a test for downloading a segment when the playlist contains #EXT-X-PROGRAM-DATE-TIME between #EXTINF and the URI, and introduced a helper for building expected sample results. [1] [2] [3]
  • Added new test playlist resources to cover these edge cases. [1] [2]

@Baraujo25 Baraujo25 closed this Jun 3, 2026
@Baraujo25

Copy link
Copy Markdown
Collaborator Author

This PR was closed since the change was more suitable to be added into the hlsparserj actively maintained by Blazemeter at https://github.com/Blazemeter/hlsparserj/

Link to the PR that fixes above problem for the plugin: Blazemeter/hlsparserj#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant