mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 10:19:24 +02:00
Moving to node_modules folder to make easier to upgrade
trying to move from Bootstrap 3 to Bootstrap 5
This commit is contained in:
parent
047e363a16
commit
d4d042e041
8460 changed files with 1355889 additions and 547977 deletions
27
node_modules/mpd-parser/src/stringToMpdXml.js
generated
vendored
Normal file
27
node_modules/mpd-parser/src/stringToMpdXml.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
import {DOMParser} from '@xmldom/xmldom';
|
||||
import errors from './errors';
|
||||
|
||||
export const stringToMpdXml = (manifestString) => {
|
||||
if (manifestString === '') {
|
||||
throw new Error(errors.DASH_EMPTY_MANIFEST);
|
||||
}
|
||||
|
||||
const parser = new DOMParser();
|
||||
let xml;
|
||||
let mpd;
|
||||
|
||||
try {
|
||||
xml = parser.parseFromString(manifestString, 'application/xml');
|
||||
mpd = xml && xml.documentElement.tagName === 'MPD' ?
|
||||
xml.documentElement : null;
|
||||
} catch (e) {
|
||||
// ie 11 throwsw on invalid xml
|
||||
}
|
||||
|
||||
if (!mpd || mpd &&
|
||||
mpd.getElementsByTagName('parsererror').length > 0) {
|
||||
throw new Error(errors.DASH_INVALID_XML);
|
||||
}
|
||||
|
||||
return mpd;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue