plugins.twitch: log ad breaks with duration #6051
Merged
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.
This logs Twitch's ad breaks and their respective durations, which is especially useful if
--twitch-disable-ads
is set, so users will know how long the output will be paused for.Everyone's invited to give this a test:
https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#pull-request-feedback
This implementation caches the ad-break's
X-TV-TWITCH-AD-COMMERCIAL-ID
metadata in order to avoid logging multiple parts of the same ad break. This is because multipleEXT-X-DATERANGE
tags can be inserted into the HLS playlists one after another, e.g. when multiple "ad-break-in-progress" placeholder loops are being shown in a row, or distinct "actual ads" are shown if enabled via--twitch-access-token-param=playerType=web
(we default to "embed" so we only see the placeholders). Those ad-part date-ranges always share the ID of the whole ad break and always include the full duration via theX-TV-TWITCH-AD-POD-FILLED-DURATION
metadata, so when the full ad break is 90s, it only logs it once instead of logging "30s" three times when there are threeEXT-X-DATERANGE
tags. There's also metadata for the number of parts in a break and the current part number, but this is irrelevant since we're only interested in the full duration which we only want to log once.Prerolls + midrolls
No prerolls