mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-28 13:08:01 +02:00
Initial support for offline playback
This commit is contained in:
parent
1372d87beb
commit
4353cacead
9 changed files with 116 additions and 50 deletions
|
@ -60,6 +60,18 @@ async function Stream() {
|
|||
}
|
||||
});
|
||||
|
||||
window.offline = new shaka.offline.Storage(audioPlayer);
|
||||
window.offline.configure({
|
||||
offline: {
|
||||
progressCallback: (data, prog) => console.log(data, prog),
|
||||
trackSelectionCallback: tracks => [
|
||||
tracks
|
||||
.sort((a, b) => a.bandwidth - b.bandwidth)
|
||||
.find(i => i.type == 'variant'),
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
audioPlayer.configure({
|
||||
preferredAudioCodecs: codecs ? codecs.split(':') : ['opus', 'mp4a'],
|
||||
manifest: {
|
||||
|
@ -171,7 +183,7 @@ onMounted(() => {
|
|||
if (data.state.urls.length > 2) {
|
||||
const i = data.state.urls.findIndex(s => s.url == data.state.url);
|
||||
|
||||
data.getSong(data.state.urls[i - 1].url);
|
||||
data.play(data.state.urls[i - 1]);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -179,7 +191,7 @@ onMounted(() => {
|
|||
if (data.state.urls.length > 2) {
|
||||
const i = data.state.urls.findIndex(s => s.url == data.state.url);
|
||||
|
||||
data.getSong(data.state.urls[i + 1].url);
|
||||
data.play(data.state.urls[i + 1]);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue