-
Notifications
You must be signed in to change notification settings - Fork 100
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
fix(parser): ensure dateRange uses startDate for condition #187
base: main
Are you sure you want to change the base?
fix(parser): ensure dateRange uses startDate for condition #187
Conversation
Is there an update on this can we get it merged? |
not inherently wrong, but there's more to it
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.
Thanks for submitting a fix! I agree this could be handled better. I think we might just want to be careful about possibly creating out of spec dateRange tags so lets see if we can do this as close to spec as possible.
@@ -715,7 +715,7 @@ export default class Parser extends Stream { | |||
message: 'EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes' | |||
}); | |||
} | |||
if (dateRange.duration && dateRange.endDate) { |
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'll defer to the discussion in #186 , but I think we may want to do something like
if (dateRange.startDate && dateRange.duration && dateRange.endDate)
instead.
Perhaps with a warning and early return if the startDate + duration !== endDate
to ensure we don't create any bad dateRanges.
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 updated the constraint to include dateRange.endDate
, ensuring that dateRanges[index].endDate
is created according to the specification and that a valid startDate
is present. This should be sufficient to prevent the creation of invalid dateRanges
, as you mentioned.
Additionally, I added a warning.
Triggers a warn event when an EXT-X-DATERANGE tag includes both DURATION and END-DATE but lacks the required START-DATE. Ensures better HLS spec compliance.
related with issue #186