mirror of
https://github.com/mmjee/Piped-Material.git
synced 2024-12-06 19:26:36 +01:00
Lots of cleanup
This commit is contained in:
+5
-1
@@ -8,10 +8,14 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^3.6.5",
|
||||
"hotkeys-js": "^3.8.7",
|
||||
"mux.js": "^5.12.2",
|
||||
"shaka-player": "^3.2.0",
|
||||
"vue": "^2.6.11",
|
||||
"vue-router": "^3.2.0",
|
||||
"vuetify": "^2.4.0",
|
||||
"vuex": "^3.4.0"
|
||||
"vuex": "^3.4.0",
|
||||
"xml-js": "^1.6.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<div>
|
||||
<p>{{ message }}</p>
|
||||
<v-btn x-large color="warning" @click="showStacktrace = !showStacktrace">Show More</v-btn>
|
||||
<p style="white-space: pre-wrap" v-if="showStacktrace">{{ error }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
error: String,
|
||||
message: String
|
||||
},
|
||||
data: () => ({
|
||||
showStacktrace: false
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -1,151 +0,0 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row class="text-center">
|
||||
<v-col cols="12">
|
||||
<v-img
|
||||
:src="require('../assets/logo.svg')"
|
||||
class="my-3"
|
||||
contain
|
||||
height="200"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
<v-col class="mb-4">
|
||||
<h1 class="display-2 font-weight-bold mb-3">
|
||||
Welcome to Vuetify
|
||||
</h1>
|
||||
|
||||
<p class="subheading font-weight-regular">
|
||||
For help and collaboration with other Vuetify developers,
|
||||
<br>please join our online
|
||||
<a
|
||||
href="https://community.vuetifyjs.com"
|
||||
target="_blank"
|
||||
>Discord Community</a>
|
||||
</p>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
class="mb-5"
|
||||
cols="12"
|
||||
>
|
||||
<h2 class="headline font-weight-bold mb-3">
|
||||
What's next?
|
||||
</h2>
|
||||
|
||||
<v-row justify="center">
|
||||
<a
|
||||
v-for="(next, i) in whatsNext"
|
||||
:key="i"
|
||||
:href="next.href"
|
||||
class="subheading mx-3"
|
||||
target="_blank"
|
||||
>
|
||||
{{ next.text }}
|
||||
</a>
|
||||
</v-row>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
class="mb-5"
|
||||
cols="12"
|
||||
>
|
||||
<h2 class="headline font-weight-bold mb-3">
|
||||
Important Links
|
||||
</h2>
|
||||
|
||||
<v-row justify="center">
|
||||
<a
|
||||
v-for="(link, i) in importantLinks"
|
||||
:key="i"
|
||||
:href="link.href"
|
||||
class="subheading mx-3"
|
||||
target="_blank"
|
||||
>
|
||||
{{ link.text }}
|
||||
</a>
|
||||
</v-row>
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
class="mb-5"
|
||||
cols="12"
|
||||
>
|
||||
<h2 class="headline font-weight-bold mb-3">
|
||||
Ecosystem
|
||||
</h2>
|
||||
|
||||
<v-row justify="center">
|
||||
<a
|
||||
v-for="(eco, i) in ecosystem"
|
||||
:key="i"
|
||||
:href="eco.href"
|
||||
class="subheading mx-3"
|
||||
target="_blank"
|
||||
>
|
||||
{{ eco.text }}
|
||||
</a>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'HelloWorld',
|
||||
|
||||
data: () => ({
|
||||
ecosystem: [
|
||||
{
|
||||
text: 'vuetify-loader',
|
||||
href: 'https://github.com/vuetifyjs/vuetify-loader'
|
||||
},
|
||||
{
|
||||
text: 'github',
|
||||
href: 'https://github.com/vuetifyjs/vuetify'
|
||||
},
|
||||
{
|
||||
text: 'awesome-vuetify',
|
||||
href: 'https://github.com/vuetifyjs/awesome-vuetify'
|
||||
}
|
||||
],
|
||||
importantLinks: [
|
||||
{
|
||||
text: 'Documentation',
|
||||
href: 'https://vuetifyjs.com'
|
||||
},
|
||||
{
|
||||
text: 'Chat',
|
||||
href: 'https://community.vuetifyjs.com'
|
||||
},
|
||||
{
|
||||
text: 'Made with Vuetify',
|
||||
href: 'https://madewithvuejs.com/vuetify'
|
||||
},
|
||||
{
|
||||
text: 'Twitter',
|
||||
href: 'https://twitter.com/vuetifyjs'
|
||||
},
|
||||
{
|
||||
text: 'Articles',
|
||||
href: 'https://medium.com/vuetify'
|
||||
}
|
||||
],
|
||||
whatsNext: [
|
||||
{
|
||||
text: 'Explore components',
|
||||
href: 'https://vuetifyjs.com/components/api-explorer'
|
||||
},
|
||||
{
|
||||
text: 'Select a layout',
|
||||
href: 'https://vuetifyjs.com/getting-started/pre-made-layouts'
|
||||
},
|
||||
{
|
||||
text: 'Frequently Asked Questions',
|
||||
href: 'https://vuetifyjs.com/getting-started/frequently-asked-questions'
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -19,7 +19,9 @@
|
||||
<script>
|
||||
import muxjs from 'mux.js'
|
||||
import shaka from 'shaka-player/dist/shaka-player.ui.js'
|
||||
import('shaka-player/dist/controls.css')
|
||||
import 'shaka-player/dist/controls.css'
|
||||
import { DashUtils } from '@/tools/DashUtils'
|
||||
|
||||
window.muxjs = muxjs
|
||||
|
||||
export default {
|
||||
@@ -65,7 +67,7 @@ export default {
|
||||
if (this.video.livestream) {
|
||||
uri = this.video.hls
|
||||
} else if (this.video.audioStreams.length > 0 && MseSupport) {
|
||||
const dash = require('@/utils/DashUtils.js').default.generate_dash_file_from_formats(
|
||||
const dash = DashUtils.generate_dash_file_from_formats(
|
||||
streams,
|
||||
this.video.duration
|
||||
)
|
||||
+1
-1
@@ -59,7 +59,7 @@ const routes = [
|
||||
},
|
||||
{
|
||||
path: '/:videoId([a-zA-Z0-9_-]{11})',
|
||||
component: () => import('@/routes/VideoRedirect')
|
||||
component: () => import('@/components/VideoRedirect')
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<ErrorHandler v-if="channel && channel.error" :message="channel.message" :error="channel.error" />
|
||||
|
||||
<div v-if="channel" v-show="!channel.error">
|
||||
<div v-else-if="channel" v-show="!channel.error">
|
||||
<h1 class="uk-text-center"><img height="48" width="48" v-bind:src="channel.avatarUrl" />{{ channel.name }}</h1>
|
||||
<img v-if="channel.bannerUrl" v-bind:src="channel.bannerUrl" style="width: 100%" loading="lazy" />
|
||||
<p style="white-space: pre-wrap">{{ channel.description }}</p>
|
||||
@@ -31,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ErrorHandler from '@/components/ErrorHandler.vue'
|
||||
import ErrorHandler from '@/components/ErrorHandler'
|
||||
import VideoItem from '@/components/VideoItem.vue'
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<template>
|
||||
<p>{{ message }}</p>
|
||||
<button uk-toggle="target: #stacktrace" class="uk-button uk-button-small" style="background: #222" type="button">
|
||||
Show More
|
||||
</button>
|
||||
<p id="stacktrace" style="white-space: pre-wrap" hidden>{{ error }}</p>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
error: String,
|
||||
message: String
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -112,7 +112,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CountryMap from '@/utils/CountryMap.js'
|
||||
import CountryMap from '@/tools/CountryMap'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
export default {
|
||||
COUNTRIES: [
|
||||
{ code: 'AD', name: 'Andorra' },
|
||||
{ code: 'AE', name: 'United Arab Emirates' },
|
||||
{ code: 'AF', name: 'Afghanistan' },
|
||||
{ code: 'AG', name: 'Antigua And Barbuda' },
|
||||
{ code: 'AI', name: 'Anguilla' },
|
||||
{ code: 'AL', name: 'Albania' },
|
||||
{ code: 'AM', name: 'Armenia' },
|
||||
{ code: 'AO', name: 'Angola' },
|
||||
{ code: 'AQ', name: 'Antarctica' },
|
||||
{ code: 'AR', name: 'Argentina' },
|
||||
{ code: 'AS', name: 'American Samoa' },
|
||||
{ code: 'AT', name: 'Austria' },
|
||||
{ code: 'AU', name: 'Australia' },
|
||||
{ code: 'AW', name: 'Aruba' },
|
||||
{ code: 'AX', name: 'Aland Islands' },
|
||||
{ code: 'AZ', name: 'Azerbaijan' },
|
||||
{ code: 'BA', name: 'Bosnia And Herzegovina' },
|
||||
{ code: 'BB', name: 'Barbados' },
|
||||
{ code: 'BD', name: 'Bangladesh' },
|
||||
{ code: 'BE', name: 'Belgium' },
|
||||
{ code: 'BF', name: 'Burkina Faso' },
|
||||
{ code: 'BG', name: 'Bulgaria' },
|
||||
{ code: 'BH', name: 'Bahrain' },
|
||||
{ code: 'BI', name: 'Burundi' },
|
||||
{ code: 'BJ', name: 'Benin' },
|
||||
{ code: 'BL', name: 'Saint Barthelemy' },
|
||||
{ code: 'BM', name: 'Bermuda' },
|
||||
{ code: 'BN', name: 'Brunei Darussalam' },
|
||||
{ code: 'BO', name: 'Bolivia' },
|
||||
{ code: 'BQ', name: 'BQ' },
|
||||
{ code: 'BR', name: 'Brazil' },
|
||||
{ code: 'BS', name: 'Bahamas' },
|
||||
{ code: 'BT', name: 'Bhutan' },
|
||||
{ code: 'BV', name: 'Bouvet Island' },
|
||||
{ code: 'BW', name: 'Botswana' },
|
||||
{ code: 'BY', name: 'Belarus' },
|
||||
{ code: 'BZ', name: 'Belize' },
|
||||
{ code: 'CA', name: 'Canada' },
|
||||
{ code: 'CC', name: 'Cocos (Keeling) Islands' },
|
||||
{ code: 'CD', name: 'Congo, Democratic Republic' },
|
||||
{ code: 'CF', name: 'Central African Republic' },
|
||||
{ code: 'CG', name: 'Congo' },
|
||||
{ code: 'CH', name: 'Switzerland' },
|
||||
{ code: 'CI', name: "Cote D'Ivoire" },
|
||||
{ code: 'CK', name: 'Cook Islands' },
|
||||
{ code: 'CL', name: 'Chile' },
|
||||
{ code: 'CM', name: 'Cameroon' },
|
||||
{ code: 'CN', name: 'China' },
|
||||
{ code: 'CO', name: 'Colombia' },
|
||||
{ code: 'CR', name: 'Costa Rica' },
|
||||
{ code: 'CU', name: 'Cuba' },
|
||||
{ code: 'CV', name: 'Cape Verde' },
|
||||
{ code: 'CW', name: 'CW' },
|
||||
{ code: 'CX', name: 'Christmas Island' },
|
||||
{ code: 'CY', name: 'Cyprus' },
|
||||
{ code: 'CZ', name: 'Czech Republic' },
|
||||
{ code: 'DE', name: 'Germany' },
|
||||
{ code: 'DJ', name: 'Djibouti' },
|
||||
{ code: 'DK', name: 'Denmark' },
|
||||
{ code: 'DM', name: 'Dominica' },
|
||||
{ code: 'DO', name: 'Dominican Republic' },
|
||||
{ code: 'DZ', name: 'Algeria' },
|
||||
{ code: 'EC', name: 'Ecuador' },
|
||||
{ code: 'EE', name: 'Estonia' },
|
||||
{ code: 'EG', name: 'Egypt' },
|
||||
{ code: 'EH', name: 'Western Sahara' },
|
||||
{ code: 'ER', name: 'Eritrea' },
|
||||
{ code: 'ES', name: 'Spain' },
|
||||
{ code: 'ET', name: 'Ethiopia' },
|
||||
{ code: 'FI', name: 'Finland' },
|
||||
{ code: 'FJ', name: 'Fiji' },
|
||||
{ code: 'FK', name: 'Falkland Islands (Malvinas)' },
|
||||
{ code: 'FM', name: 'Micronesia, Federated States Of' },
|
||||
{ code: 'FO', name: 'Faroe Islands' },
|
||||
{ code: 'FR', name: 'France' },
|
||||
{ code: 'GA', name: 'Gabon' },
|
||||
{ code: 'GB', name: 'United Kingdom' },
|
||||
{ code: 'GD', name: 'Grenada' },
|
||||
{ code: 'GE', name: 'Georgia' },
|
||||
{ code: 'GF', name: 'French Guiana' },
|
||||
{ code: 'GG', name: 'Guernsey' },
|
||||
{ code: 'GH', name: 'Ghana' },
|
||||
{ code: 'GI', name: 'Gibraltar' },
|
||||
{ code: 'GL', name: 'Greenland' },
|
||||
{ code: 'GM', name: 'Gambia' },
|
||||
{ code: 'GN', name: 'Guinea' },
|
||||
{ code: 'GP', name: 'Guadeloupe' },
|
||||
{ code: 'GQ', name: 'Equatorial Guinea' },
|
||||
{ code: 'GR', name: 'Greece' },
|
||||
{ code: 'GS', name: 'South Georgia And Sandwich Isl.' },
|
||||
{ code: 'GT', name: 'Guatemala' },
|
||||
{ code: 'GU', name: 'Guam' },
|
||||
{ code: 'GW', name: 'Guinea-Bissau' },
|
||||
{ code: 'GY', name: 'Guyana' },
|
||||
{ code: 'HK', name: 'Hong Kong' },
|
||||
{ code: 'HM', name: 'Heard Island & Mcdonald Islands' },
|
||||
{ code: 'HN', name: 'Honduras' },
|
||||
{ code: 'HR', name: 'Croatia' },
|
||||
{ code: 'HT', name: 'Haiti' },
|
||||
{ code: 'HU', name: 'Hungary' },
|
||||
{ code: 'ID', name: 'Indonesia' },
|
||||
{ code: 'IE', name: 'Ireland' },
|
||||
{ code: 'IL', name: 'Israel' },
|
||||
{ code: 'IM', name: 'Isle Of Man' },
|
||||
{ code: 'IN', name: 'India' },
|
||||
{ code: 'IO', name: 'British Indian Ocean Territory' },
|
||||
{ code: 'IQ', name: 'Iraq' },
|
||||
{ code: 'IR', name: 'Iran, Islamic Republic Of' },
|
||||
{ code: 'IS', name: 'Iceland' },
|
||||
{ code: 'IT', name: 'Italy' },
|
||||
{ code: 'JE', name: 'Jersey' },
|
||||
{ code: 'JM', name: 'Jamaica' },
|
||||
{ code: 'JO', name: 'Jordan' },
|
||||
{ code: 'JP', name: 'Japan' },
|
||||
{ code: 'KE', name: 'Kenya' },
|
||||
{ code: 'KG', name: 'Kyrgyzstan' },
|
||||
{ code: 'KH', name: 'Cambodia' },
|
||||
{ code: 'KI', name: 'Kiribati' },
|
||||
{ code: 'KM', name: 'Comoros' },
|
||||
{ code: 'KN', name: 'Saint Kitts And Nevis' },
|
||||
{ code: 'KP', name: 'KP' },
|
||||
{ code: 'KR', name: 'Korea' },
|
||||
{ code: 'KW', name: 'Kuwait' },
|
||||
{ code: 'KY', name: 'Cayman Islands' },
|
||||
{ code: 'KZ', name: 'Kazakhstan' },
|
||||
{ code: 'LA', name: "Lao People's Democratic Republic" },
|
||||
{ code: 'LB', name: 'Lebanon' },
|
||||
{ code: 'LC', name: 'Saint Lucia' },
|
||||
{ code: 'LI', name: 'Liechtenstein' },
|
||||
{ code: 'LK', name: 'Sri Lanka' },
|
||||
{ code: 'LR', name: 'Liberia' },
|
||||
{ code: 'LS', name: 'Lesotho' },
|
||||
{ code: 'LT', name: 'Lithuania' },
|
||||
{ code: 'LU', name: 'Luxembourg' },
|
||||
{ code: 'LV', name: 'Latvia' },
|
||||
{ code: 'LY', name: 'Libyan Arab Jamahiriya' },
|
||||
{ code: 'MA', name: 'Morocco' },
|
||||
{ code: 'MC', name: 'Monaco' },
|
||||
{ code: 'MD', name: 'Moldova' },
|
||||
{ code: 'ME', name: 'Montenegro' },
|
||||
{ code: 'MF', name: 'Saint Martin' },
|
||||
{ code: 'MG', name: 'Madagascar' },
|
||||
{ code: 'MH', name: 'Marshall Islands' },
|
||||
{ code: 'MK', name: 'Macedonia' },
|
||||
{ code: 'ML', name: 'Mali' },
|
||||
{ code: 'MM', name: 'Myanmar' },
|
||||
{ code: 'MN', name: 'Mongolia' },
|
||||
{ code: 'MO', name: 'Macao' },
|
||||
{ code: 'MP', name: 'Northern Mariana Islands' },
|
||||
{ code: 'MQ', name: 'Martinique' },
|
||||
{ code: 'MR', name: 'Mauritania' },
|
||||
{ code: 'MS', name: 'Montserrat' },
|
||||
{ code: 'MT', name: 'Malta' },
|
||||
{ code: 'MU', name: 'Mauritius' },
|
||||
{ code: 'MV', name: 'Maldives' },
|
||||
{ code: 'MW', name: 'Malawi' },
|
||||
{ code: 'MX', name: 'Mexico' },
|
||||
{ code: 'MY', name: 'Malaysia' },
|
||||
{ code: 'MZ', name: 'Mozambique' },
|
||||
{ code: 'NA', name: 'Namibia' },
|
||||
{ code: 'NC', name: 'New Caledonia' },
|
||||
{ code: 'NE', name: 'Niger' },
|
||||
{ code: 'NF', name: 'Norfolk Island' },
|
||||
{ code: 'NG', name: 'Nigeria' },
|
||||
{ code: 'NI', name: 'Nicaragua' },
|
||||
{ code: 'NL', name: 'Netherlands' },
|
||||
{ code: 'NO', name: 'Norway' },
|
||||
{ code: 'NP', name: 'Nepal' },
|
||||
{ code: 'NR', name: 'Nauru' },
|
||||
{ code: 'NU', name: 'Niue' },
|
||||
{ code: 'NZ', name: 'New Zealand' },
|
||||
{ code: 'OM', name: 'Oman' },
|
||||
{ code: 'PA', name: 'Panama' },
|
||||
{ code: 'PE', name: 'Peru' },
|
||||
{ code: 'PF', name: 'French Polynesia' },
|
||||
{ code: 'PG', name: 'Papua New Guinea' },
|
||||
{ code: 'PH', name: 'Philippines' },
|
||||
{ code: 'PK', name: 'Pakistan' },
|
||||
{ code: 'PL', name: 'Poland' },
|
||||
{ code: 'PM', name: 'Saint Pierre And Miquelon' },
|
||||
{ code: 'PN', name: 'Pitcairn' },
|
||||
{ code: 'PR', name: 'Puerto Rico' },
|
||||
{ code: 'PS', name: 'Palestinian Territory, Occupied' },
|
||||
{ code: 'PT', name: 'Portugal' },
|
||||
{ code: 'PW', name: 'Palau' },
|
||||
{ code: 'PY', name: 'Paraguay' },
|
||||
{ code: 'QA', name: 'Qatar' },
|
||||
{ code: 'RE', name: 'Reunion' },
|
||||
{ code: 'RO', name: 'Romania' },
|
||||
{ code: 'RS', name: 'Serbia' },
|
||||
{ code: 'RU', name: 'Russian Federation' },
|
||||
{ code: 'RW', name: 'Rwanda' },
|
||||
{ code: 'SA', name: 'Saudi Arabia' },
|
||||
{ code: 'SB', name: 'Solomon Islands' },
|
||||
{ code: 'SC', name: 'Seychelles' },
|
||||
{ code: 'SD', name: 'Sudan' },
|
||||
{ code: 'SE', name: 'Sweden' },
|
||||
{ code: 'SG', name: 'Singapore' },
|
||||
{ code: 'SH', name: 'Saint Helena' },
|
||||
{ code: 'SI', name: 'Slovenia' },
|
||||
{ code: 'SJ', name: 'Svalbard And Jan Mayen' },
|
||||
{ code: 'SK', name: 'Slovakia' },
|
||||
{ code: 'SL', name: 'Sierra Leone' },
|
||||
{ code: 'SM', name: 'San Marino' },
|
||||
{ code: 'SN', name: 'Senegal' },
|
||||
{ code: 'SO', name: 'Somalia' },
|
||||
{ code: 'SR', name: 'Suriname' },
|
||||
{ code: 'SS', name: 'SS' },
|
||||
{ code: 'ST', name: 'Sao Tome And Principe' },
|
||||
{ code: 'SV', name: 'El Salvador' },
|
||||
{ code: 'SX', name: 'SX' },
|
||||
{ code: 'SY', name: 'Syrian Arab Republic' },
|
||||
{ code: 'SZ', name: 'Swaziland' },
|
||||
{ code: 'TC', name: 'Turks And Caicos Islands' },
|
||||
{ code: 'TD', name: 'Chad' },
|
||||
{ code: 'TF', name: 'French Southern Territories' },
|
||||
{ code: 'TG', name: 'Togo' },
|
||||
{ code: 'TH', name: 'Thailand' },
|
||||
{ code: 'TJ', name: 'Tajikistan' },
|
||||
{ code: 'TK', name: 'Tokelau' },
|
||||
{ code: 'TL', name: 'Timor-Leste' },
|
||||
{ code: 'TM', name: 'Turkmenistan' },
|
||||
{ code: 'TN', name: 'Tunisia' },
|
||||
{ code: 'TO', name: 'Tonga' },
|
||||
{ code: 'TR', name: 'Turkey' },
|
||||
{ code: 'TT', name: 'Trinidad And Tobago' },
|
||||
{ code: 'TV', name: 'Tuvalu' },
|
||||
{ code: 'TW', name: 'Taiwan' },
|
||||
{ code: 'TZ', name: 'Tanzania' },
|
||||
{ code: 'UA', name: 'Ukraine' },
|
||||
{ code: 'UG', name: 'Uganda' },
|
||||
{ code: 'UM', name: 'United States Outlying Islands' },
|
||||
{ code: 'US', name: 'United States' },
|
||||
{ code: 'UY', name: 'Uruguay' },
|
||||
{ code: 'UZ', name: 'Uzbekistan' },
|
||||
{ code: 'VA', name: 'Holy See (Vatican City State)' },
|
||||
{ code: 'VC', name: 'Saint Vincent And Grenadines' },
|
||||
{ code: 'VE', name: 'Venezuela' },
|
||||
{ code: 'VG', name: 'Virgin Islands, British' },
|
||||
{ code: 'VI', name: 'Virgin Islands, U.S.' },
|
||||
{ code: 'VN', name: 'Viet Nam' },
|
||||
{ code: 'VU', name: 'Vanuatu' },
|
||||
{ code: 'WF', name: 'Wallis And Futuna' },
|
||||
{ code: 'WS', name: 'Samoa' },
|
||||
{ code: 'YE', name: 'Yemen' },
|
||||
{ code: 'YT', name: 'Mayotte' },
|
||||
{ code: 'ZA', name: 'South Africa' },
|
||||
{ code: 'ZM', name: 'Zambia' },
|
||||
{ code: 'ZW', name: 'Zimbabwe' }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
// Based of https://github.com/GilgusMaximus/yt-dash-manifest-generator/blob/master/src/DashGenerator.js
|
||||
|
||||
import xml from 'xml-js'
|
||||
|
||||
const DashUtils = {
|
||||
generate_dash_file_from_formats (VideoFormats, VideoLength) {
|
||||
const generatedJSON = this.generate_xmljs_json_from_data(VideoFormats, VideoLength)
|
||||
return xml.json2xml(generatedJSON)
|
||||
},
|
||||
generate_xmljs_json_from_data (VideoFormatArray, VideoLength) {
|
||||
const convertJSON = {
|
||||
declaration: {
|
||||
attributes: {
|
||||
version: '1.0',
|
||||
encoding: 'utf-8'
|
||||
}
|
||||
},
|
||||
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: this.generate_adaptation_set(VideoFormatArray)
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
return convertJSON
|
||||
},
|
||||
generate_adaptation_set (VideoFormatArray) {
|
||||
const adaptationSets = []
|
||||
const mimeTypes = []
|
||||
const mimeObjects = [[]]
|
||||
// sort the formats by mime types
|
||||
VideoFormatArray.forEach(videoFormat => {
|
||||
// the dual formats should not be used
|
||||
if (videoFormat.mimeType.indexOf('video') !== -1 && !videoFormat.videoOnly) {
|
||||
return
|
||||
}
|
||||
// if these properties are not available, then we skip it because we cannot set these properties
|
||||
// if (!(videoFormat.hasOwnProperty('initRange') && videoFormat.hasOwnProperty('indexRange'))) {
|
||||
// return
|
||||
// }
|
||||
const mimeType = videoFormat.mimeType
|
||||
const mimeTypeIndex = mimeTypes.indexOf(mimeType)
|
||||
if (mimeTypeIndex > -1) {
|
||||
mimeObjects[mimeTypeIndex].push(videoFormat)
|
||||
} else {
|
||||
mimeTypes.push(mimeType)
|
||||
mimeObjects.push([])
|
||||
mimeObjects[mimeTypes.length - 1].push(videoFormat)
|
||||
}
|
||||
})
|
||||
// for each MimeType generate a new Adaptation set with Representations as sub elements
|
||||
for (let i = 0; i < mimeTypes.length; i++) {
|
||||
let isVideoFormat = false
|
||||
const adapSet = {
|
||||
type: 'element',
|
||||
name: 'AdaptationSet',
|
||||
attributes: {
|
||||
id: i,
|
||||
mimeType: mimeTypes[i],
|
||||
startWithSAP: '1',
|
||||
subsegmentAlignment: 'true'
|
||||
},
|
||||
elements: []
|
||||
}
|
||||
if (!mimeTypes[i].includes('audio')) {
|
||||
adapSet.attributes.scanType = 'progressive'
|
||||
isVideoFormat = true
|
||||
}
|
||||
mimeObjects[i].forEach(format => {
|
||||
if (isVideoFormat) {
|
||||
adapSet.elements.push(this.generate_representation_video(format))
|
||||
} else {
|
||||
adapSet.elements.push(this.generate_representation_audio(format))
|
||||
}
|
||||
})
|
||||
adaptationSets.push(adapSet)
|
||||
}
|
||||
return adaptationSets
|
||||
},
|
||||
generate_representation_audio (Format) {
|
||||
const representation = {
|
||||
type: 'element',
|
||||
name: 'Representation',
|
||||
attributes: {
|
||||
id: Format.itag,
|
||||
codecs: Format.codec,
|
||||
bandwidth: Format.bitrate
|
||||
},
|
||||
elements: [
|
||||
{
|
||||
type: 'element',
|
||||
name: 'AudioChannelConfiguration',
|
||||
attributes: {
|
||||
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
|
||||
},
|
||||
generate_representation_video (Format) {
|
||||
const representation = {
|
||||
type: 'element',
|
||||
name: 'Representation',
|
||||
attributes: {
|
||||
id: Format.itag,
|
||||
codecs: Format.codec,
|
||||
bandwidth: Format.bitrate,
|
||||
width: Format.width,
|
||||
height: Format.height,
|
||||
maxPlayoutRate: '1',
|
||||
frameRate: Format.fps
|
||||
},
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
DashUtils
|
||||
}
|
||||
@@ -864,7 +864,7 @@
|
||||
"@babel/types" "^7.4.4"
|
||||
esutils "^2.0.2"
|
||||
|
||||
"@babel/runtime@^7.11.0", "@babel/runtime@^7.8.4":
|
||||
"@babel/runtime@^7.11.0", "@babel/runtime@^7.11.2", "@babel/runtime@^7.8.4":
|
||||
version "7.14.6"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.6.tgz#535203bc0892efc7dec60bdc27b2ecf6e409062d"
|
||||
integrity sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==
|
||||
@@ -3466,6 +3466,11 @@ elliptic@^6.5.3:
|
||||
minimalistic-assert "^1.0.1"
|
||||
minimalistic-crypto-utils "^1.0.1"
|
||||
|
||||
eme-encryption-scheme-polyfill@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/eme-encryption-scheme-polyfill/-/eme-encryption-scheme-polyfill-2.0.3.tgz#2ca6e06480e06cceb5e50efd27943ac46c959878"
|
||||
integrity sha512-44CNFMsqzHdKHrzWxlS7xZ8KUHn5XutBqpmCuWzNIynmAyFInHrrD3ozv/RvK9ZhgV6QY6Easx8EWAmxteNodg==
|
||||
|
||||
emoji-regex@^7.0.1:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
|
||||
@@ -4640,6 +4645,11 @@ hosted-git-info@^2.1.4:
|
||||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
|
||||
integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
|
||||
|
||||
hotkeys-js@^3.8.7:
|
||||
version "3.8.7"
|
||||
resolved "https://registry.yarnpkg.com/hotkeys-js/-/hotkeys-js-3.8.7.tgz#c16cab978b53d7242f860ca3932e976b92399981"
|
||||
integrity sha512-ckAx3EkUr5XjDwjEHDorHxRO2Kb7z6Z2Sxul4MbBkN8Nho7XDslQsgMJT+CiJ5Z4TgRxxvKHEpuLE3imzqy4Lg==
|
||||
|
||||
hpack.js@^2.1.6:
|
||||
version "2.1.6"
|
||||
resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2"
|
||||
@@ -6050,6 +6060,13 @@ mute-stream@0.0.8:
|
||||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
|
||||
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==
|
||||
|
||||
mux.js@^5.12.2:
|
||||
version "5.12.2"
|
||||
resolved "https://registry.yarnpkg.com/mux.js/-/mux.js-5.12.2.tgz#cd823312f4bb69adb8b9c5f45635b4451066d6e6"
|
||||
integrity sha512-9OY1lrFIo7FxMeIC6aLUftiNv97AztufDfi30N7qDll1Pcy7bCxlHztyHp1Ce0KQwy2XqchGeENPS4v1NJngHQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.11.2"
|
||||
|
||||
mz@^2.4.0:
|
||||
version "2.7.0"
|
||||
resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32"
|
||||
@@ -7684,7 +7701,7 @@ sass@~1.32.0:
|
||||
dependencies:
|
||||
chokidar ">=3.0.0 <4.0.0"
|
||||
|
||||
sax@~1.2.4:
|
||||
sax@^1.2.4, sax@~1.2.4:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
|
||||
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
|
||||
@@ -7842,6 +7859,13 @@ sha.js@^2.4.0, sha.js@^2.4.8:
|
||||
inherits "^2.0.1"
|
||||
safe-buffer "^5.0.1"
|
||||
|
||||
shaka-player@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/shaka-player/-/shaka-player-3.2.0.tgz#612c61b0a05aed8173c8fb55161eb05f61309955"
|
||||
integrity sha512-JwFYNB+jgXKIwukncYEnU3wqR/ScyxpPNkSVUgT4Qxt4uPOkEBwPuZr9cpeqBUMQi6lXpBVTztC76AooPOpZ5g==
|
||||
dependencies:
|
||||
eme-encryption-scheme-polyfill "^2.0.3"
|
||||
|
||||
shebang-command@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
|
||||
@@ -9221,6 +9245,13 @@ ws@^6.0.0, ws@^6.2.1:
|
||||
dependencies:
|
||||
async-limiter "~1.0.0"
|
||||
|
||||
xml-js@^1.6.11:
|
||||
version "1.6.11"
|
||||
resolved "https://registry.yarnpkg.com/xml-js/-/xml-js-1.6.11.tgz#927d2f6947f7f1c19a316dd8eea3614e8b18f8e9"
|
||||
integrity sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==
|
||||
dependencies:
|
||||
sax "^1.2.4"
|
||||
|
||||
xtend@^4.0.0, xtend@~4.0.1:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
|
||||
|
||||
Reference in New Issue
Block a user