From 02692a262c060d7a61e854634ea58f3b6bad62fa Mon Sep 17 00:00:00 2001 From: Roee Kasher Date: Sun, 14 Aug 2016 11:52:24 +0300 Subject: [PATCH] Fixed a bug regarding VOD videos --- parser.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/parser.js b/parser.js index d4d3f4d..8e55579 100644 --- a/parser.js +++ b/parser.js @@ -41,7 +41,18 @@ m3uParser.prototype.parse = function parse(line) { this.linesRead++; return true; } - if (['', '#EXT-X-ENDLIST'].indexOf(line) > -1) return true; + + if (!line) { + return true; + } + + // If a m3u8 file has a #EXT-X-ENDLIST item, it is a VOD, so we change its playlist type to VOD. Otherwise, this item + // is missing from the output m3u8 file, and players might think that a video is a LIVE-STREAM even if it is not... + if (line === '#EXT-X-ENDLIST') { + this.m3u.set('playlistType', 'VOD'); + return true; + } + if (line.indexOf('#') == 0) { this.parseLine(line); } else {