-
Notifications
You must be signed in to change notification settings - Fork 0
Handle weird segment extensions #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the segment URI extension handling logic to better support segment URLs with query parameters or other extensions beyond the basic file extension. The change centralizes the demuxing engine resolution logic and modifies the pattern matching to handle cases where extensions might be followed by additional content.
- Extracts duplicated demuxing engine resolution logic into a shared utility function
- Updates pattern matching to handle segment URIs with query parameters or additional content after the extension
- Bumps version from 0.1.2 to 0.1.3
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| mix.exs | Version bump to 0.1.3 |
| lib/ex_hls/client/vod.ex | Refactored to use centralized demuxing engine resolution utility |
| lib/ex_hls/client/utils.ex | Added new utility function with updated pattern matching for extensions |
| lib/ex_hls/client/live/reader.ex | Refactored to use centralized demuxing engine resolution utility |
| README.md | Updated dependency version in documentation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
lib/ex_hls/client/utils.ex
Outdated
|
|
||
| @spec resolve_demuxing_engine_impl(String.t()) :: atom() | ||
| def resolve_demuxing_engine_impl(segment_uri) do | ||
| case Path.extname(segment_uri) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the more proper way to do it would be to do:
URI.parse!(segment_uri).path
|> Path.extname()
|> case do
".ts" -> DemuxingEngine.MPEGTS
".m4s" -> DemuxingEngine.CMAF
".mp4" -> DemuxingEngine.CMAF
_other -> raise "Unsupported segment URI extension: #{segment_uri |> inspect()}"
end
because this way we let URI retrieve the proper "path" for us, which we can later use with Path.extname().
varsill
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
I got a playlist like this from the internet and IMO we should be able to handle it