Right now, all HLS playlists are HLSPlaylist type. You can tell if a playlist is master or variant by inspecting the type.
However, there are weak typing issues in HLSPlaylist. The mediaSegmentGroups and all the HLSPlaylistTimelineTranslator don't really make sense unless the playlist is a Variant. Also, this situation leads to a lot of:
guard playlist.type == .master else {
// exit with an error, exception and possibly an assert
}
which could be avoided with strong typing.
Tasks
It's not 100% clear what the correct solution is. Perhaps the HLSParser could have two success callbacks, one for master and one for variant playlists.
Most functionality should be shared between HLSMasterPlaylist and HLSVariantPlaylist. It's only mediaSegmentGroups and HLSPlaylistTimelineTranslator that are specific to HLSVariantPlaylist. I would imagine that HLSMasterPlaylist could have some specific functionality to deal with #EXT-X-STREAM-INF tags paired with variant urls (similar to mediaSegmentGroups).
We should have an agreement about architecture before going forward.
Description
Right now, all HLS playlists are
HLSPlaylist
type. You can tell if a playlist is master or variant by inspecting thetype
.However, there are weak typing issues in
HLSPlaylist
. ThemediaSegmentGroups
and all theHLSPlaylistTimelineTranslator
don't really make sense unless the playlist is a Variant. Also, this situation leads to a lot of:which could be avoided with strong typing.
Tasks
It's not 100% clear what the correct solution is. Perhaps the
HLSParser
could have two success callbacks, one for master and one for variant playlists.Most functionality should be shared between
HLSMasterPlaylist
andHLSVariantPlaylist
. It's onlymediaSegmentGroups
andHLSPlaylistTimelineTranslator
that are specific toHLSVariantPlaylist
. I would imagine thatHLSMasterPlaylist
could have some specific functionality to deal with#EXT-X-STREAM-INF
tags paired with variant urls (similar tomediaSegmentGroups
).We should have an agreement about architecture before going forward.
This will be a large architectural change.