mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-25 23:17:22 +00:00
Merge pull request #3224 from TeamPiped/xmljs-remove
Remove xml-js for fast-xml-parser
This commit is contained in:
commit
af2fca4dab
@ -15,19 +15,17 @@
|
|||||||
"@fortawesome/free-brands-svg-icons": "6.5.1",
|
"@fortawesome/free-brands-svg-icons": "6.5.1",
|
||||||
"@fortawesome/free-solid-svg-icons": "6.5.1",
|
"@fortawesome/free-solid-svg-icons": "6.5.1",
|
||||||
"@fortawesome/vue-fontawesome": "3.0.5",
|
"@fortawesome/vue-fontawesome": "3.0.5",
|
||||||
"buffer": "6.0.3",
|
|
||||||
"dompurify": "3.0.6",
|
"dompurify": "3.0.6",
|
||||||
|
"fast-xml-parser": "4.3.2",
|
||||||
"hotkeys-js": "3.12.2",
|
"hotkeys-js": "3.12.2",
|
||||||
"javascript-time-ago": "2.5.9",
|
"javascript-time-ago": "2.5.9",
|
||||||
"linkify-html": "4.1.3",
|
"linkify-html": "4.1.3",
|
||||||
"linkifyjs": "4.1.3",
|
"linkifyjs": "4.1.3",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"shaka-player": "4.7.1",
|
"shaka-player": "4.7.1",
|
||||||
"stream-browserify": "3.0.0",
|
|
||||||
"vue": "3.3.10",
|
"vue": "3.3.10",
|
||||||
"vue-i18n": "9.8.0",
|
"vue-i18n": "9.8.0",
|
||||||
"vue-router": "4.2.5",
|
"vue-router": "4.2.5"
|
||||||
"xml-js": "1.6.11"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/fa6-brands": "1.1.17",
|
"@iconify-json/fa6-brands": "1.1.17",
|
||||||
|
@ -17,12 +17,12 @@ dependencies:
|
|||||||
'@fortawesome/vue-fontawesome':
|
'@fortawesome/vue-fontawesome':
|
||||||
specifier: 3.0.5
|
specifier: 3.0.5
|
||||||
version: 3.0.5(@fortawesome/fontawesome-svg-core@6.5.1)(vue@3.3.10)
|
version: 3.0.5(@fortawesome/fontawesome-svg-core@6.5.1)(vue@3.3.10)
|
||||||
buffer:
|
|
||||||
specifier: 6.0.3
|
|
||||||
version: 6.0.3
|
|
||||||
dompurify:
|
dompurify:
|
||||||
specifier: 3.0.6
|
specifier: 3.0.6
|
||||||
version: 3.0.6
|
version: 3.0.6
|
||||||
|
fast-xml-parser:
|
||||||
|
specifier: 4.3.2
|
||||||
|
version: 4.3.2
|
||||||
hotkeys-js:
|
hotkeys-js:
|
||||||
specifier: 3.12.2
|
specifier: 3.12.2
|
||||||
version: 3.12.2
|
version: 3.12.2
|
||||||
@ -41,9 +41,6 @@ dependencies:
|
|||||||
shaka-player:
|
shaka-player:
|
||||||
specifier: 4.7.1
|
specifier: 4.7.1
|
||||||
version: 4.7.1
|
version: 4.7.1
|
||||||
stream-browserify:
|
|
||||||
specifier: 3.0.0
|
|
||||||
version: 3.0.0
|
|
||||||
vue:
|
vue:
|
||||||
specifier: 3.3.10
|
specifier: 3.3.10
|
||||||
version: 3.3.10(typescript@5.3.2)
|
version: 3.3.10(typescript@5.3.2)
|
||||||
@ -53,9 +50,6 @@ dependencies:
|
|||||||
vue-router:
|
vue-router:
|
||||||
specifier: 4.2.5
|
specifier: 4.2.5
|
||||||
version: 4.2.5(vue@3.3.10)
|
version: 4.2.5(vue@3.3.10)
|
||||||
xml-js:
|
|
||||||
specifier: 1.6.11
|
|
||||||
version: 1.6.11
|
|
||||||
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@iconify-json/fa6-brands':
|
'@iconify-json/fa6-brands':
|
||||||
@ -2623,10 +2617,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
|
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/base64-js@1.5.1:
|
|
||||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/big-integer@1.6.52:
|
/big-integer@1.6.52:
|
||||||
resolution: {integrity: sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==}
|
resolution: {integrity: sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==}
|
||||||
engines: {node: '>=0.6'}
|
engines: {node: '>=0.6'}
|
||||||
@ -2683,13 +2673,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
|
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/buffer@6.0.3:
|
|
||||||
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
|
|
||||||
dependencies:
|
|
||||||
base64-js: 1.5.1
|
|
||||||
ieee754: 1.2.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/builtin-modules@3.3.0:
|
/builtin-modules@3.3.0:
|
||||||
resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==}
|
resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
@ -3318,6 +3301,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}
|
resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/fast-xml-parser@4.3.2:
|
||||||
|
resolution: {integrity: sha512-rmrXUXwbJedoXkStenj1kkljNF7ugn5ZjR9FJcwmCfcCbtOMDghPajbc+Tck6vE6F5XsDmx+Pr2le9fw8+pXBg==}
|
||||||
|
hasBin: true
|
||||||
|
dependencies:
|
||||||
|
strnum: 1.0.5
|
||||||
|
dev: false
|
||||||
|
|
||||||
/fastq@1.15.0:
|
/fastq@1.15.0:
|
||||||
resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==}
|
resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -3594,10 +3584,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==}
|
resolution: {integrity: sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/ieee754@1.2.1:
|
|
||||||
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/ignore@5.3.0:
|
/ignore@5.3.0:
|
||||||
resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==}
|
resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==}
|
||||||
engines: {node: '>= 4'}
|
engines: {node: '>= 4'}
|
||||||
@ -3625,6 +3611,7 @@ packages:
|
|||||||
|
|
||||||
/inherits@2.0.4:
|
/inherits@2.0.4:
|
||||||
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/internal-slot@1.0.6:
|
/internal-slot@1.0.6:
|
||||||
resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==}
|
resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==}
|
||||||
@ -4460,15 +4447,6 @@ packages:
|
|||||||
safe-buffer: 5.2.1
|
safe-buffer: 5.2.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/readable-stream@3.6.2:
|
|
||||||
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
|
|
||||||
engines: {node: '>= 6'}
|
|
||||||
dependencies:
|
|
||||||
inherits: 2.0.4
|
|
||||||
string_decoder: 1.3.0
|
|
||||||
util-deprecate: 1.0.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/readdirp@3.6.0:
|
/readdirp@3.6.0:
|
||||||
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
|
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
|
||||||
engines: {node: '>=8.10.0'}
|
engines: {node: '>=8.10.0'}
|
||||||
@ -4635,6 +4613,7 @@ packages:
|
|||||||
|
|
||||||
/safe-buffer@5.2.1:
|
/safe-buffer@5.2.1:
|
||||||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/safe-regex-test@1.0.0:
|
/safe-regex-test@1.0.0:
|
||||||
resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==}
|
resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==}
|
||||||
@ -4644,10 +4623,6 @@ packages:
|
|||||||
is-regex: 1.1.4
|
is-regex: 1.1.4
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/sax@1.3.0:
|
|
||||||
resolution: {integrity: sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/semver@6.3.1:
|
/semver@6.3.1:
|
||||||
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
|
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@ -4763,13 +4738,6 @@ packages:
|
|||||||
deprecated: Please use @jridgewell/sourcemap-codec instead
|
deprecated: Please use @jridgewell/sourcemap-codec instead
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/stream-browserify@3.0.0:
|
|
||||||
resolution: {integrity: sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==}
|
|
||||||
dependencies:
|
|
||||||
inherits: 2.0.4
|
|
||||||
readable-stream: 3.6.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/string-width@4.2.3:
|
/string-width@4.2.3:
|
||||||
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
|
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@ -4818,12 +4786,6 @@ packages:
|
|||||||
es-abstract: 1.22.3
|
es-abstract: 1.22.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/string_decoder@1.3.0:
|
|
||||||
resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
|
|
||||||
dependencies:
|
|
||||||
safe-buffer: 5.2.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/stringify-object@3.3.0:
|
/stringify-object@3.3.0:
|
||||||
resolution: {integrity: sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==}
|
resolution: {integrity: sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
@ -4859,6 +4821,10 @@ packages:
|
|||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/strnum@1.0.5:
|
||||||
|
resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/supports-color@5.5.0:
|
/supports-color@5.5.0:
|
||||||
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
|
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
@ -5158,6 +5124,7 @@ packages:
|
|||||||
|
|
||||||
/util-deprecate@1.0.2:
|
/util-deprecate@1.0.2:
|
||||||
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/vite-plugin-eslint@1.8.1(eslint@8.55.0)(vite@5.0.5):
|
/vite-plugin-eslint@1.8.1(eslint@8.55.0)(vite@5.0.5):
|
||||||
resolution: {integrity: sha512-PqdMf3Y2fLO9FsNPmMX+//2BF5SF8nEWspZdgl4kSt7UvHDRHVVfHvxsD7ULYzZrJDGRxR81Nq7TOFgwMnUang==}
|
resolution: {integrity: sha512-PqdMf3Y2fLO9FsNPmMX+//2BF5SF8nEWspZdgl4kSt7UvHDRHVVfHvxsD7ULYzZrJDGRxR81Nq7TOFgwMnUang==}
|
||||||
@ -5493,13 +5460,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/xml-js@1.6.11:
|
|
||||||
resolution: {integrity: sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==}
|
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
|
||||||
sax: 1.3.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/xml-name-validator@4.0.0:
|
/xml-name-validator@4.0.0:
|
||||||
resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==}
|
resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
@ -1,42 +1,33 @@
|
|||||||
// Based of https://github.com/GilgusMaximus/yt-dash-manifest-generator/blob/master/src/DashGenerator.js
|
// Based of https://github.com/GilgusMaximus/yt-dash-manifest-generator/blob/master/src/DashGenerator.js
|
||||||
|
import { XMLBuilder } from "fast-xml-parser";
|
||||||
import { Buffer } from "buffer";
|
|
||||||
window.Buffer = Buffer;
|
|
||||||
import { json2xml } from "xml-js";
|
|
||||||
|
|
||||||
export function generate_dash_file_from_formats(VideoFormats, VideoLength) {
|
export function generate_dash_file_from_formats(VideoFormats, VideoLength) {
|
||||||
const generatedJSON = generate_xmljs_json_from_data(VideoFormats, VideoLength);
|
const generatedJSON = generate_xmljs_json_from_data(VideoFormats, VideoLength);
|
||||||
return json2xml(generatedJSON);
|
const builder = new XMLBuilder({
|
||||||
|
ignoreAttributes: false,
|
||||||
|
allowBooleanAttributes: true,
|
||||||
|
suppressBooleanAttributes: false,
|
||||||
|
attributeNamePrefix: "_",
|
||||||
|
});
|
||||||
|
return builder.build(generatedJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_xmljs_json_from_data(VideoFormatArray, VideoLength) {
|
function generate_xmljs_json_from_data(VideoFormatArray, VideoLength) {
|
||||||
const convertJSON = {
|
const convertJSON = {
|
||||||
declaration: {
|
"?xml": {
|
||||||
attributes: {
|
_version: "1.0",
|
||||||
version: "1.0",
|
_encoding: "utf-8",
|
||||||
encoding: "utf-8",
|
MPD: {
|
||||||
|
_xmlns: "urn:mpeg:dash:schema:mpd:2011",
|
||||||
|
_profiles: "urn:mpeg:dash:profile:full:2011",
|
||||||
|
_minBufferTime: "PT1.5S",
|
||||||
|
_type: "static",
|
||||||
|
_mediaPresentationDuration: `PT${VideoLength}S`,
|
||||||
|
Period: {
|
||||||
|
AdaptationSet: generate_adaptation_set(VideoFormatArray),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
type: "element",
|
|
||||||
name: "MPD",
|
|
||||||
attributes: {
|
|
||||||
xmlns: "urn:mpeg:dash:schema:mpd:2011",
|
|
||||||
profiles: "urn:mpeg:dash:profile:full:2011",
|
|
||||||
minBufferTime: "PT1.5S",
|
|
||||||
type: "static",
|
|
||||||
mediaPresentationDuration: `PT${VideoLength}S`,
|
|
||||||
},
|
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
type: "element",
|
|
||||||
name: "Period",
|
|
||||||
elements: generate_adaptation_set(VideoFormatArray),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
return convertJSON;
|
return convertJSON;
|
||||||
}
|
}
|
||||||
@ -76,34 +67,27 @@ function generate_adaptation_set(VideoFormatArray) {
|
|||||||
|
|
||||||
mimeAudioObjs.forEach(mimeAudioObj => {
|
mimeAudioObjs.forEach(mimeAudioObj => {
|
||||||
const adapSet = {
|
const adapSet = {
|
||||||
type: "element",
|
_id: mimeAudioObj.audioTrackId,
|
||||||
name: "AdaptationSet",
|
_lang: mimeAudioObj.audioTrackId?.substr(0, 2),
|
||||||
attributes: {
|
_mimeType: mimeAudioObj.mimeType,
|
||||||
id: mimeAudioObj.audioTrackId,
|
_startWithSAP: "1",
|
||||||
lang: mimeAudioObj.audioTrackId?.substr(0, 2),
|
_subsegmentAlignment: "true",
|
||||||
mimeType: mimeAudioObj.mimeType,
|
Representation: [],
|
||||||
startWithSAP: "1",
|
|
||||||
subsegmentAlignment: "true",
|
|
||||||
},
|
|
||||||
elements: [],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let isVideoFormat = false;
|
let isVideoFormat = false;
|
||||||
|
|
||||||
if (mimeAudioObj.mimeType.includes("video")) {
|
if (mimeAudioObj.mimeType.includes("video")) {
|
||||||
isVideoFormat = true;
|
isVideoFormat = true;
|
||||||
}
|
adapSet["_scanType"] = "progressive";
|
||||||
|
|
||||||
if (isVideoFormat) {
|
|
||||||
adapSet.attributes.scanType = "progressive";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < mimeAudioObj.videoFormats.length; i++) {
|
for (var i = 0; i < mimeAudioObj.videoFormats.length; i++) {
|
||||||
const videoFormat = mimeAudioObj.videoFormats[i];
|
const videoFormat = mimeAudioObj.videoFormats[i];
|
||||||
if (isVideoFormat) {
|
if (isVideoFormat) {
|
||||||
adapSet.elements.push(generate_representation_video(videoFormat));
|
adapSet.Representation.push(generate_representation_video(videoFormat));
|
||||||
} else {
|
} else {
|
||||||
adapSet.elements.push(generate_representation_audio(videoFormat));
|
adapSet.Representation.push(generate_representation_audio(videoFormat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,94 +98,40 @@ function generate_adaptation_set(VideoFormatArray) {
|
|||||||
|
|
||||||
function generate_representation_audio(Format) {
|
function generate_representation_audio(Format) {
|
||||||
const representation = {
|
const representation = {
|
||||||
type: "element",
|
_id: Format.itag,
|
||||||
name: "Representation",
|
_codecs: Format.codec,
|
||||||
attributes: {
|
_bandwidth: Format.bitrate,
|
||||||
id: Format.itag,
|
AudioChannelConfiguration: {
|
||||||
codecs: Format.codec,
|
_schemeIdUri: "urn:mpeg:dash:23003:3:audio_channel_configuration:2011",
|
||||||
bandwidth: Format.bitrate,
|
_value: "2",
|
||||||
},
|
},
|
||||||
elements: [
|
BaseURL: Format.url,
|
||||||
{
|
SegmentBase: {
|
||||||
type: "element",
|
_indexRange: `${Format.indexStart}-${Format.indexEnd}`,
|
||||||
name: "AudioChannelConfiguration",
|
Initialization: {
|
||||||
attributes: {
|
_range: `${Format.initStart}-${Format.initEnd}`,
|
||||||
schemeIdUri: "urn:mpeg:dash:23003:3:audio_channel_configuration:2011",
|
|
||||||
value: "2",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
type: "element",
|
|
||||||
name: "BaseURL",
|
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
text: Format.url,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "element",
|
|
||||||
name: "SegmentBase",
|
|
||||||
attributes: {
|
|
||||||
indexRange: `${Format.indexStart}-${Format.indexEnd}`,
|
|
||||||
},
|
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
type: "element",
|
|
||||||
name: "Initialization",
|
|
||||||
attributes: {
|
|
||||||
range: `${Format.initStart}-${Format.initEnd}`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
return representation;
|
return representation;
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_representation_video(Format) {
|
function generate_representation_video(Format) {
|
||||||
const representation = {
|
const representation = {
|
||||||
type: "element",
|
_id: Format.itag,
|
||||||
name: "Representation",
|
_codecs: Format.codec,
|
||||||
attributes: {
|
_bandwidth: Format.bitrate,
|
||||||
id: Format.itag,
|
_width: Format.width,
|
||||||
codecs: Format.codec,
|
_height: Format.height,
|
||||||
bandwidth: Format.bitrate,
|
_maxPlayoutRate: "1",
|
||||||
width: Format.width,
|
_frameRate: Format.fps,
|
||||||
height: Format.height,
|
BaseURL: Format.url,
|
||||||
maxPlayoutRate: "1",
|
SegmentBase: {
|
||||||
frameRate: Format.fps,
|
_indexRange: `${Format.indexStart}-${Format.indexEnd}`,
|
||||||
|
Initialization: {
|
||||||
|
_range: `${Format.initStart}-${Format.initEnd}`,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
type: "element",
|
|
||||||
name: "BaseURL",
|
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
text: Format.url,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "element",
|
|
||||||
name: "SegmentBase",
|
|
||||||
attributes: {
|
|
||||||
indexRange: `${Format.indexStart}-${Format.indexEnd}`,
|
|
||||||
},
|
|
||||||
elements: [
|
|
||||||
{
|
|
||||||
type: "element",
|
|
||||||
name: "Initialization",
|
|
||||||
attributes: {
|
|
||||||
range: `${Format.initStart}-${Format.initEnd}`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
return representation;
|
return representation;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,6 @@ export default defineConfig({
|
|||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@": path.resolve(__dirname, "./src"),
|
"@": path.resolve(__dirname, "./src"),
|
||||||
stream: "stream-browserify",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
Loading…
Reference in New Issue
Block a user