mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-28 05:08:00 +02:00
Changes:
- Relocated code from App.vue to their respective stores - Linked to privacy page in wiki (related to #15)
This commit is contained in:
parent
1b5ee1d2d5
commit
44db54737b
17 changed files with 666 additions and 620 deletions
|
@ -26,3 +26,33 @@ export function useStore() {
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function useMetadata(url, urls, data) {
|
||||
if ('mediaSession' in navigator) {
|
||||
const now = urls.filter(u => u.url === url)[0];
|
||||
|
||||
let artwork = [],
|
||||
album = undefined;
|
||||
|
||||
if (now) {
|
||||
album = now.subtitle;
|
||||
|
||||
if (now.thumbnails) {
|
||||
artwork = now.thumbnails.map(t => ({
|
||||
sizes: t.width && t.height ? t.width + 'x' + t.height : '512x512',
|
||||
src: t.url,
|
||||
type: 'image/webp',
|
||||
}));
|
||||
} else artwork = [{ src: data.art, type: 'image/webp' }];
|
||||
|
||||
console.log(album, artwork);
|
||||
}
|
||||
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
title: data.title,
|
||||
artist: data.artist,
|
||||
album: album,
|
||||
artwork: artwork,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue