Master Playlist vs Media Playlist: HLS's Two Levels
HLS uses two levels of playlists: the master playlist and the media playlist. Understanding their division of labour is key to reading HLS.
Master playlist: "what choices are there?"
The master playlist doesn't list actual segments. Instead it lists bitrate variants, each declared with #EXT-X-STREAM-INF carrying bandwidth, resolution and codec attributes, and pointing to a media playlist. The player uses it to pick a variant.
Media playlist: "in what order do I play?"
A media playlist lists segment URLs and durations, along with encryption and discontinuity information. The player downloads segments and feeds them into the buffer in order.
Why two levels
The design decouples "choosing a variant" from "playing segments". When quality changes, the player only swaps one media playlist instead of re-parsing the whole stream; it also keeps multi-language and multi-subtitle organisation clear.