- Range Headers for videoplayback
- Changed behaviour of local playlists
- Added UTC timestamps to footer
This commit is contained in:
Shiny Nematoda 2022-11-26 07:48:13 +00:00
parent dac17fbc2d
commit 599e024afa
No known key found for this signature in database
GPG key ID: 6506D50F5613A42D
12 changed files with 465 additions and 416 deletions

3
src/assets/version.json Normal file
View file

@ -0,0 +1,3 @@
{
"date": "2022-11-26"
}

View file

@ -2,8 +2,9 @@
import { ref, watch } from 'vue';
const props = defineProps(['display', 'title', 'n']),
emit = defineEmits(['show']),
show = ref(props.display);
emit = defineEmits(['show']);
const show = ref(props.display);
watch(
() => props.display,
@ -13,7 +14,7 @@ watch(
},
);
watch(show, n => {
watch(show, () => {
emit('show', show.value);
});
</script>

View file

@ -6,19 +6,22 @@ import Modal from './Modal.vue';
import { useRand } from '@/scripts/colors.js';
import { useStore } from '@/scripts/util.js';
import {
useAuthCreatePlaylist,
getAuthPlaylists,
getJsonAuth,
} from '@/scripts/fetch.js';
import { useI18n } from '@/stores/misc.js';
import {
useListPlaylists,
useGetPlaylist,
useCreatePlaylist,
useUpdatePlaylist,
} from '../scripts/db.js';
} from '@/scripts/db.js';
import {
useAuthCreatePlaylist,
getAuthPlaylists,
getJsonAuth,
} from '@/scripts/fetch.js';
import { useResults } from '@/stores/results.js';
import { useI18n, useNav } from '@/stores/misc.js';
const { t } = useI18n(),
store = useStore(),
@ -46,13 +49,18 @@ const emit = defineEmits(['play-urls', 'open-playlist']),
const pathname = url => new URL(url).pathname;
const Play = key => {
const Open = key => {
console.log(key);
useGetPlaylist(key, res => {
console.log(res);
if (res.urls.length > 0) {
emit('play-urls', res.urls);
useResults().items.songs = {
title: 'Local • ' + key,
items: res.urls.map(i => ({ ...i, ...{ thumbnail: '/1x1.png' } })),
};
useNav().state.page = 'home';
} else alert('No songs to play!');
});
},
@ -286,7 +294,7 @@ onMounted(async () => {
:name="i.name"
:author="t('title.songs') + ' • ' + i.urls.length"
:grad="useRand()"
@open-album="Play(i.name)" />
@open-album="Open(i.name)" />
</template>
</div>

View file

@ -66,6 +66,22 @@ async function Stream() {
const codecs = useStore().getItem('codec');
audioPlayer
.getNetworkingEngine()
.registerRequestFilter((_type, req) => {
const headers = req.headers;
let url = new URL(req.uris[0]);
if (url.pathname.indexOf('/videoplayback') > -1) {
if (headers.Range) {
url.searchParams.set('range', headers.Range.split('=')[1]);
req.headers = {};
req.uris[0] = url.toString();
}
}
});
audioPlayer.configure({
preferredAudioCodecs: codecs ? codecs.split(':') : ['opus', 'mp4a'],
manifest: {

View file

@ -6,10 +6,16 @@ import {
HYPERPIPE_INSTANCE,
getJson,
} from '@/scripts/fetch.js';
import { useStore } from '@/scripts/util.js';
import { useStore } from '@/scripts/util.js';
import { SUPPORTED_LOCALES, useI18n } from '@/stores/misc.js';
const date = ref('unknown');
import('@/assets/version.json').then(v => {
date.value = v.date;
});
const { t, setupLocale } = useI18n(),
instances = ref([]),
hypInstances = ref([]),
@ -286,6 +292,7 @@ onMounted(() => {
</div>
<footer>
{{ date }}
<a
class="bi bi-code-slash"
target="_blank"

View file

@ -22,8 +22,9 @@ const props = defineProps({
art: String,
playlistId: String,
}),
emit = defineEmits(['open-song', 'remove']),
show = ref(false);
emit = defineEmits(['open-song', 'remove']);
const show = ref(false);
const openSong = el => {
if (!el.classList.contains('ign')) {

View file

@ -25,6 +25,7 @@ export function useDash(streams, len) {
name: 'AdaptationSet',
attributes: {
id: i,
contentType: 'audio',
mimeType: mimeTypes[i],
startWithSAP: '1',
subsegmentAlignment: 'true',
@ -108,6 +109,9 @@ export function useDash(streams, len) {
{
type: 'element',
name: 'Period',
attributes: {
id: 0,
},
elements: sets,
},
],

View file

@ -34,7 +34,7 @@ export const SUPPORTED_LOCALES = [
},
{
code: 'fa',
name: 'فارسی'
name: 'فارسی',
},
{
code: 'fr',

View file

@ -68,7 +68,6 @@ export const useResults = defineStore('results', () => {
useNav().state.page = 'home';
next.value = hash + '?nextpage=' + encodeURIComponent(json.nextpage);
}
return {