- added shuffle/save/clear to queue
- custom piped api (1/2 #154)
- track numbers for songs in album/playlist (see #147)
- use dash if managed mse is available
- store artist name for local playlist
This commit is contained in:
Shiny Nematoda 2023-12-12 09:31:31 +00:00
parent d1592eef0c
commit 129f14c64f
13 changed files with 541 additions and 452 deletions

View file

@ -5,6 +5,8 @@ import { useStore, useRoute, useManifest } from '@/scripts/util.js';
import { useData, usePlayer } from '@/stores/player.js';
import { useAlert } from '@/stores/misc';
let shaka;
const player = usePlayer(),
data = useData(),
store = useStore(),
@ -25,11 +27,11 @@ function audioCanPlay() {
}
async function Stream() {
const res = player.state,
shaka = await import('shaka-player/dist/shaka-player.compiled.js').then(
mod => mod.default,
);
const res = player.state;
shaka ??= await import('shaka-player/dist/shaka-player.compiled.js').then(
mod => mod.default,
);
const { url, mime } = await useManifest(res);
@ -40,7 +42,7 @@ async function Stream() {
const audioPlayer = new shaka.Player(),
codecs = store.getItem('codec');
await audioPlayer.attach(audio.value)
await audioPlayer.attach(audio.value);
audioPlayer.getNetworkingEngine().registerRequestFilter((_type, req) => {
const headers = req.headers;
@ -110,7 +112,7 @@ async function Stream() {
})
.catch(err => {
console.error(err);
if (err.code == 3016) a.add('MediaError: ' + err.data[0])
if (err.code == 3016) a.add('MediaError: ' + err.data[0]);
else a.add('Error: ' + err.code);
});
}