A browser HLS session is not a file download with a progress bar. It is a scheduler. The first URL is text. That text names more text, then a small init object, maybe a key object, and a moving list of media segments. The player has to decide when to reload the playlist, which rendition to hold, how far to sit from the live edge, and when a later hop is allowed to fail without taking the whole session down.

This teardown is about that scheduler. It is not a first-playback tutorial, a tag glossary, or a fail-path FAQ. Stay on streams you own or are allowed to play. A browser HLS stream player is cited only as a clean in-page bench: paste an authorized playlist, watch the fetches, and keep the work inside the same origin rules a production page will hit.

Three clocks, one presentation

A progressive MP4 has one clock: byte offset versus decode timestamp. HLS has three, and they drift independently.

The playlist clock is the reload cadence of the media playlist. On VOD, ENDLIST closes it. On a live window there is no end tag, so the document must be fetched again on a period tied to TARGETDURATION. Cache that document as a static file and the scheduler asks for segments that have already left the window.

The fetch clock is the next object the page still needs: an init map, a key URI, or the next media segment. Those URLs are resolved against the playlist that named them, not against the page. A 200 on the master playlist does not start this clock. A 200 on the media playlist starts it only for the children that document currently lists.

The decode clock is the media element's playhead versus the buffer the page has already appended. The scheduler's job is to keep a short decoded window ahead of that playhead without sitting so far behind a live edge that the next reload is already stale, and without sitting so close that one late segment empties the buffer.

When those clocks disagree, the session looks "broken" even though every individual request returned 200. The player did not fail as a decoder. It scheduled the wrong object, at the wrong time, from the wrong document.

Live MEDIA-SEQUENCE versus VOD ENDLIST

On VOD the media playlist is a closed list. MEDIA-SEQUENCE, if present, is stable. The scheduler prefetches a short run of segments, appends them in file order, and only re-reads the playlist if it needs a new init or key tag. There is no reason to poll a document that cannot grow.

On a live playlist the list is a sliding window. Early segments fall off. New ones are appended. MEDIA-SEQUENCE increases. The scheduler must:

  1. Reload the media playlist on a cadence near the target duration, with a small jitter so many clients do not stampede.
  2. Map sequence numbers to URLs from the current document, not from a copy held in memory from two reloads ago.
  3. Choose a start offset from the live edge. Starting at the oldest listed segment can sit tens of seconds behind the encoder. Starting at only the newest segment can leave nothing to decode if the next reload is late.
  4. Treat a 404 on a named segment as a window move first, a missing object second. Reload, read the new sequence, then decide.

A compact live media playlist makes the moving parts visible. The segment names are examples and will not play:

#EXTM3U #EXT-X-VERSION:7 #EXT-X-TARGETDURATION:6 #EXT-X-MEDIA-SEQUENCE:18420 #EXT-X-MAP:URI="init.mp4" #EXT-X-KEY:METHOD=AES-128,URI="key.bin" #EXTINF:6.006, seg18420.m4s #EXTINF:6.006, seg18421.m4s #EXTINF:6.006, seg18422.m4s 

There is no ENDLIST. The next reload may start at 18421. A client that still requests seg18420.m4s after that reload is not "retrying the player." It is asking for a sequence number the origin has already dropped.

Rendition holds are scheduler decisions

After the master playlist is parsed, the client picks a media playlist. That pick is a hold, not a one-time setting.

CODECS is the hard filter. If this document cannot configure a SourceBuffer for that fourCC list, the row is not a candidate. RESOLUTION is a display cap: a 3840-wide rendition is wasted on a 1280-wide element. BANDWIDTH is an advertised bitrate, compared with recent download rate and a safety margin.

A switch is a new branch in the graph: a new media playlist fetch, a possible new init, a possible new key, and a splice onto the same presentation timeline. The scheduler should not switch on a single slow segment. It should switch when buffer health and recent throughput agree for more than one target duration. Each switch restarts the fetch clock on the new document.

Decrypt is a hop, not a flag

When EXT-X-KEY names AES-128, the key URI is a first-class object. The playlist can parse, the init map can load, and the session still stalls if that URI returns 403, an HTML error page, or a body this origin is not allowed to read.

The decrypt step runs on the segment bytes after they arrive. A CORS miss on the key host presents as "segments download, frames never start." A wrong or rotated key presents the same way. Isolate the hop before changing buffer sizes or switching renditions.

The key object is sticky for the tagged range. A later key tag can rotate it. The scheduler must not reuse a previous key across a rotation, and must not assume the key host is the playlist host.

Init maps and the last hop into a media element

fMP4 fragments assume an initialization section. The map tag names that object. Without it, later .m4s bodies may parse as bytes and still fail to decode. The init is fetched once per map, then held. A map tag that changes mid-window is a new init hop, not a suggestion.

Once init, key (if any), and a first media segment are in hand, the page appends to a SourceBuffer. That is the last hop. The media element only sees a buffer of configured media. It does not know about playlists. If the buffer starves, the element stalls; the cause is still one of the earlier clocks.

Local remux is a later packaging step, after a session already plays. It will not repair a failed hop. When a VOD window is complete and authorized, convert M3U8 to MP4 online runs in the page so the merge stays on the device. Use it after the scheduler has already named a stable ENDLIST session, not as a workaround for a live window that will not hold.

Why the bench has to be a browser tab

A tool that is not a browser tab can hide the origin rules the real session will hit. Cookie, CORS, and redirect behavior on the playlist host can differ from the segment host and the key host. The Online HLS Player keeps those hops in the page: it fetches the playlists, selects a rendition, and tries to hold a buffer, so you can see which request is in flight when a clock slips.

Paste the same authorized URL you will use in production. Watch whether the playlist clock reloads, whether MEDIA-SEQUENCE moves, and whether the next 404 is a dropped window or a missing object. Then take the failing URL back to the host that should serve it. The product does not proxy video and does not sell channels. It is a local inspect-and-play surface.

What to inspect next

  • Confirm the first URL is a master or media playlist, and resolve every child against the document that declared it.
  • Separate the playlist clock from the fetch clock from the decode clock before changing the player.
  • On live windows, reload and read MEDIA-SEQUENCE; on VOD, look for ENDLIST and stop polling.
  • Treat the key URI and the init map as hops. A readable playlist is not proof that decrypt or decode can start.
  • Switch renditions only when codecs, resolution, and recent throughput agree. A switch is a new graph, not a slider.
  • After a VOD session already plays, remux is packaging. It is not a repair for a live scheduler that is one window behind.