// get your manifest in whatever way works best// for example, by reading the file from the filesystem in node// or using fetch in a browser like so:const manifestUri = 'https://example.com/dash.xml';const res = await fetch(manifestUri);const manifest = await res.text();// A callback function to handle events like errors or warningsconst eventHandler = ({ type, message }) => console.log(`${type}: ${message}`);var parsedManifest = mpdParser.parse(manifest, { manifestUri, eventHandler });
If dealing with a live stream, then on subsequent calls to parse, the previously parsed
manifest object should be provided as an option to parse using the previousManifest
option:
const newParsedManifest = mpdParser.parse( manifest, // parsedManifest comes from the prior example { manifestUri, previousManifest: parsedManifest });
Parsed Output
The parser ouputs a plain javascript object with the following structure: