This is still a bit of WIP as I want to add jsdocs to everything I added, but wanted to get review up for the actual implementation.
Start of supporting live streams. This only adds support for manifests with SegmentTemplate tags that use the duration attribute. It might already work with SegmentList@duration, but I have not tested that.
This PR also includes a refactor in the way attributes are handled. Previous the getAttributes function just created a key value map where all the values were strings. This meant we had to parse them everywhere we used them. I added parsing for specific attributes that we know how they should be parsed at the time of getting them from the node, so the rest of code can operate on it without repeatedly parsing it.
A note with the attribute parsing, it will have issues if multiple tags have the same name but need different parsers for their values. Period@duration is expressed as a duration string, while SegmentTemplate@duration is just an integer for seconds. You can see I address this by checking NaN. This also alerted me to an issue we will encounter when we tackle multi-period support, because of the way we merge attributes down the call chain for inheritance, shared attributes like this will be lost. Something to think about, but it doesn't seem to be a concern for until multi-period happens.
This is still a bit of WIP as I want to add jsdocs to everything I added, but wanted to get review up for the actual implementation.
Start of supporting live streams. This only adds support for manifests with SegmentTemplate tags that use the
duration
attribute. It might already work with SegmentList@duration, but I have not tested that.This PR also includes a refactor in the way attributes are handled. Previous the
getAttributes
function just created a key value map where all the values were strings. This meant we had to parse them everywhere we used them. I added parsing for specific attributes that we know how they should be parsed at the time of getting them from the node, so the rest of code can operate on it without repeatedly parsing it.A note with the attribute parsing, it will have issues if multiple tags have the same name but need different parsers for their values. Period@duration is expressed as a duration string, while SegmentTemplate@duration is just an integer for seconds. You can see I address this by checking
NaN
. This also alerted me to an issue we will encounter when we tackle multi-period support, because of the way we merge attributes down the call chain for inheritance, shared attributes like this will be lost. Something to think about, but it doesn't seem to be a concern for until multi-period happens.edit: Merged in https://github.com/mjneil/mpd-parser/pull/1 edit2: merged https://github.com/mjneil/mpd-parser/pull/2