videojs / m3u8-parser

An m3u8 parser.
Other
473 stars 98 forks source link

Can EXT-X-I-FRAME-STREAM-INF be supported? #100

Open SamJarmanPP opened 4 years ago

SamJarmanPP commented 4 years ago

I'd like to see support for the parsing of#EXT-X-I-FRAME-STREAM-INF lines. eg #EXT-X-I-FRAME-STREAM-INF: BANDWIDTH=100403,RESOLUTION=392x216,CODECS="avc1.42c01e",URI="QualityLevels(90258)/Manifest(video,format=m3u8-aapl,type=keyframes)"

I tried to make a custom parser for this, but I cant seem to get it to work right with an object for each time this line occurs (many times)

Any ideas welcome, Thanks!

nosteine commented 4 years ago

@SamJarmanPP, is the problem you are facing that you only get one parsed object instead of an array of them ?

SamJarmanPP commented 4 years ago

Honestly, I cant remember now. But that does sound right - is that the current behaviour?

nosteine commented 4 years ago

I believe so. I played around with it today and I have quite a simple fix. I plan to submit a PR on Sunday. See how it goes

nosteine commented 4 years ago

106

JeppeTh commented 3 years ago

Does this mean EXT-X-I-FRAME-STREAM-INF still is only supported by making custom parser?

Yes it seems so after some testing...

torgeilo commented 3 years ago

Workaround:

const entries = [];

parser.addParser({
  expression: /^#EXT-X-I-FRAME-STREAM-INF/,
  customType: 'iframes',
  dataParser: (line) => {
    // Process line into entry...
    entries.push(entry);
    return entries;
  }
});

parser.push(data);
parser.end();

parser.manifest.custom.iframes   // <- Array of entries.
JeppeTh commented 3 years ago

Thx - I guess it should be

entries.push(line)

?

Not sure videojs-http-streaming support custom stuff though where I use this. The playlist contains a mixture of these INFs and "regular # variants" - I tried to removed those to make sure custom was used - but then it didn't work. Perhaps I removed too much...

I noticed I could provide a customTagParser to videojs-http-streaming - seemed to parse it - but still couldn't play the stream...