Git Product home page Git Product logo

Comments (2)

gkatsev avatar gkatsev commented on September 27, 2024

I think it's because we only expect BaseURL elements to be children the MPD element rather than inside a Period.

from mpd-parser.

Jssly avatar Jssly commented on September 27, 2024

@gkatsev

I got the same issue on this website. My research result is that it's a regex issue here: https://github.com/videojs/mpd-parser/blob/main/src/segment/segmentTemplate.js#L6

const identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g;

In this example the regex is $Number%08x$, not match to identifierPattern. The code should be

const identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)([d,x]))?\$/g;

another issue is the number need to be set as hex format in function https://github.com/videojs/mpd-parser/blob/main/src/segment/segmentTemplate.js#L44

here is my solution:
export const identifierReplacement = (values) => (match, identifier, format, width, base) => {
if (match === '$$') {
// escape sequence
return '$';
}

if (typeof values[identifier] === 'undefined') {
return match;
}

let value = '' + values[identifier];

if (identifier === 'RepresentationID') {
// Format tag shall not be present with RepresentationID
return value;
}

if (!format) {
width = 1;
} else {
width = parseInt(width, 10);
}

if(base ==='x') {
value = parseInt(value).toString(16)
}

if (value.length >= width) {
return value;
}

return ${(new Array(width - value.length + 1)).join('0')}${value};
};

from mpd-parser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.