Lots of cleanup

This commit is contained in:
root
2021-07-20 13:34:01 +05:30
parent bd189d4325
commit 355be0505f
13 changed files with 509 additions and 176 deletions
+19
View File
@@ -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>
-151
View File
@@ -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
View File
@@ -59,7 +59,7 @@ const routes = [
},
{
path: '/:videoId([a-zA-Z0-9_-]{11})',
component: () => import('@/routes/VideoRedirect')
component: () => import('@/components/VideoRedirect')
}
]
+2 -2
View File
@@ -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 {
-16
View File
@@ -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>
+2 -1
View File
@@ -112,7 +112,8 @@
</template>
<script>
import CountryMap from '@/utils/CountryMap.js'
import CountryMap from '@/tools/CountryMap'
export default {
data () {
return {
+253
View File
@@ -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' }
]
}
+190
View File
@@ -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
}