grafov / m3u8

Parser and generator of M3U8-playlists for Apple HLS. Library for Go language. :cinema:
http://tools.ietf.org/html/draft-pantos-http-live-streaming
BSD 3-Clause "New" or "Revised" License
1.22k stars 312 forks source link

Ignore blank lines in playlist -- fixes panic w/EXT-X-MAP. #178

Open ejohnst opened 2 years ago

ejohnst commented 2 years ago

reader.go panics if there's a blank line between the header containing EXT-X-MAP and the first segment for FMP4 media playlists. (It tries to add MAP to the first segment, which it hasn't created yet.)

Patch fixes this by ignoring blank lines; reader_test.go updated to work with change (one of the tests assumed prior behavior).

@eric confirms this is consistent with the standard:

Lines in a Playlist file are terminated by either a single line feed character or a carriage return character followed by a line feed character. Each line is a URI, is blank, or starts with the character '#'. Blank lines are ignored. Whitespace MUST NOT be present, except for elements in which it is explicitly specified.

Issue seems to have been previously reported as #166.