Closed beta2k closed 3 years ago
Looks like our example is slightly misleading. Specifically, it doesn't make any network calls itself to download the manifest, you must download it yourself and provide it to mpd-parser. (I think the <>
in the example was supposed to be a stand-in for a manifest).
Currently, parse
accepts the string value of the manifest and an options object. Looks like our example is actually out of date with the current state of the module.
Should be something like:
const manifestUri = 'https://cdxaws-ak.akamaized.net/out/v1/23240f1b2b1242ac8226d6f1a8653bfc/469c706849ff410385e5d65308566647/5e2a57fc0380466b9864849ce3f168ea/manifest.mpd');
const res = await fetch(manifestUri);
const mpdString = await res.text();
mpdParser.parse(mpdString, { manifestUri });
Ah okay, that makes sense then. So I have the raw MPD, but I need to escape everything such as quotes when feeding it into the manifest
variable?
Hm, now I convert all of the following characters to entities: ", <, > and &. Furthermore I removed all line breaks.
HTML looks like this:
Still I get this error:
you don't need to encode those entities. You just want the literal string representation of the manifest. The easiest way to get it is to download it from the url you have and then pass that response text into the mpd parser.
Thanks for your help. Maybe I'm being slow here, but don't I at least have to escape double quote and line breaks? because if I simply copy+paste the content of the MPD into the HTML, I get:
Uncaught SyntaxError: Invalid or unexpected token
Yes, I would recommend against copy-pasting the XML in. Is there a reason why you can't fetch or XHR the manifest?
Of course, I could fetch it ;) Sorry, I was thinking to complicated. Anyway, got it to work now by escaping double quotes and removing line breaks. Thanks!
My HTML looks like this:
However, I get this error:
The MPD URL is
What am I doing wrong?