videojs / m3u8-parser

An m3u8 parser.
Other
473 stars 98 forks source link

parse title from extinf #90

Closed AminTaghikhani closed 1 year ago

AminTaghikhani commented 5 years ago

Hi there,

how can I parse title from the extint? reference

I create

parser.addParser({
                    expression: /#EXTINF/,
                    customType: 'audio',
                    segment: true,
                    dataParser: function (line) {
                        const valuePart = line.split(':')
                        const values = valuePart[1].split(',')
                        const duration = parseFloat(values[0])
                        const title = values[1]
                        return {
                            duration,
                            title
                        };
                    }
                });

but only work for the last item, and the segment doesn't contain anything

AminTaghikhani commented 5 years ago

I read your codes, I found this line

regex rule is ok, but I think somewhere ignoring (this)

gkatsev commented 4 years ago

Looks like we don't read it and set it out on the output here https://github.com/videojs/m3u8-parser/blob/07bd668ddb5070fff57f5e5fe86959e18f49c4e3/src/parser.js#L106-L131