m3u8-parser icon indicating copy to clipboard operation
m3u8-parser copied to clipboard

feat: add raw list of segment lines to manifest

Open jeff-transmit opened this issue 4 years ago • 8 comments

Feature #49

Adds raw segment lines to the parsed manifest.

Playlist:

#EXTM3U
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:10
#EXTINF:10,
media-00001.ts
#EXTINF:10,
media-00002.ts
#EXTINF:10,
media-00003.ts
#EXTINF:10,
media-00004.ts
#EXT-X-ENDLIST

Parsed output:

{
  allowCache: true,
  mediaSequence: 0,
  playlistType: 'VOD',
  segments: [
    {
      duration: 10,
      raw: [
        '#EXTINF:10,',
        'media-00001.ts'
      ],
      timeline: 0,
      uri: 'media-00001.ts'
    },
    {
      duration: 10,
      raw: [
        '#EXTINF:10,',
        'media-00002.ts'
      ],
      timeline: 0,
      uri: 'media-00002.ts'
    },
    {
      duration: 10,
      raw: [
        '#EXTINF:10,',
        'media-00003.ts'
      ],
      timeline: 0,
      uri: 'media-00003.ts'
    },
    {
      duration: 10,
      raw: [
        '#EXTINF:10,',
        'media-00004.ts'
      ],
      timeline: 0,
      uri: 'media-00004.ts'
    }
  ],
  targetDuration: 10,
  endList: true,
  discontinuitySequence: 0,
  discontinuityStarts: []
}

jeff-transmit avatar Jul 13 '21 00:07 jeff-transmit

Can you provide more info on why this would be useful?

gkatsev avatar Jul 13 '21 21:07 gkatsev

Ah, missed the link to the issue.

gkatsev avatar Jul 13 '21 21:07 gkatsev

I think my main concern here is that we often have memory issues in VHS and keeping around even more strings is going to exacerbate it.

gkatsev avatar Jul 13 '21 21:07 gkatsev

One alternative would be to feature flag this and make it default off and then if someone needs it, they can have it.

I think a concrete usecase would be nice, though.

gkatsev avatar Jul 13 '21 21:07 gkatsev

One alternative would be to feature flag this and make it default off and then if someone needs it, they can have it.

I think a concrete usecase would be nice, though.

In our case, we need to be able to change and rebuild the playlist after using the parsed playlist and it would be more efficient to do this with the raw segment lines rather than processing the whole playlist again.

jeff-transmit avatar Jul 14 '21 14:07 jeff-transmit

Are you using m3u8-parser directly or via VHS?

gkatsev avatar Jul 14 '21 16:07 gkatsev

Are you using m3u8-parser directly or via VHS?

We are using it directly.

jeff-transmit avatar Jul 14 '21 16:07 jeff-transmit

IIMO there could be a pluggable metod to create event data or could be via events allowing to movidy events/source as callback, kind of the data parser for custom tari. No constructor changes (imagine, next version requires new param, actual core feature, this time required, to be added or removed)

peterblazejewicz avatar Sep 05 '21 21:09 peterblazejewicz