Search code examples
m3u8http-live-streaming

Determining HLS stream content type


I have written a simple parser for parsing Media Playlist file (m3u8) (HLS stream)

"EXT-X-PLAYLIST-TYPE" tag is used to determine the type of content i.e. whether the content is VOD (can't change) or EVENT (can change).

My problem is that "EXT-X-PLAYLIST-TYPE" is an optional tag. If EXT-X-PLAYLIST-TYPE tag is not present in the Media Playlist file, is there a way I can determine the content type?

Currently I check for "EXT-X-ENDLIST" which indicates that no more Media Segments will be added to the Media Playlist file. Is this approach check correct?


Solution

  • Okay, I think it should be fine, According to the player playlist specification:

    https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-14#page-29

    If the Media Playlist contains the final Media Segment of the presentation then the Playlist file MUST contain the EXT-X-ENDLIST tag; this allows clients to minimize unproductive Playlist reloads.

    If a Media Playlist does not contain the EXT-X-ENDLIST tag, the server MUST make a new version of the Playlist file available that contains at least one new Media Segment. It MUST be made available relative to the time that the previous version of the Playlist file was made available: no earlier than one-half the target duration after that time, and no later than 1.5 times the target duration after that time. This allows clients to utilize the network efficiently.