mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
minor refactors
This commit is contained in:
@@ -2,38 +2,40 @@ import perks from "./perks.js";
|
||||
import playAudio from "./playAudio.js";
|
||||
|
||||
let showMediaNotif = () => {
|
||||
let current = perks.current.value;
|
||||
|
||||
if ("mediaSession" in navigator) {
|
||||
navigator.mediaSession.metadata = new window.MediaMetadata({
|
||||
title: perks.current.value.title,
|
||||
artist: perks.current.value.artists,
|
||||
title: current.title,
|
||||
artist: current.artists,
|
||||
artwork: [
|
||||
{
|
||||
src: perks.current.value.image,
|
||||
src: current.image,
|
||||
sizes: "96x96",
|
||||
type: "image/jpeg",
|
||||
},
|
||||
{
|
||||
src: perks.current.value.image,
|
||||
src: current.image,
|
||||
sizes: "128x128",
|
||||
type: "image/png",
|
||||
},
|
||||
{
|
||||
src: perks.current.value.image,
|
||||
src: current.image,
|
||||
sizes: "192x192",
|
||||
type: "image/png",
|
||||
},
|
||||
{
|
||||
src: perks.current.value.image,
|
||||
src: current.image,
|
||||
sizes: "256x256",
|
||||
type: "image/png",
|
||||
},
|
||||
{
|
||||
src: perks.current.value.image,
|
||||
src: current.image,
|
||||
sizes: "384x384",
|
||||
type: "image/png",
|
||||
},
|
||||
{
|
||||
src: perks.current.value.image,
|
||||
src: current.image,
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ref } from "@vue/reactivity";
|
||||
import { watch } from "@vue/runtime-core";
|
||||
|
||||
import media from './mediaNotification.js'
|
||||
import media from "./mediaNotification.js";
|
||||
|
||||
const current = ref({
|
||||
title: "Nothing played yet",
|
||||
@@ -82,7 +82,7 @@ const readQueue = () => {
|
||||
};
|
||||
|
||||
watch(current, (new_current, old_current) => {
|
||||
media.showMediaNotif()
|
||||
media.showMediaNotif();
|
||||
localStorage.setItem("current", JSON.stringify(new_current));
|
||||
|
||||
const index = queue.value.findIndex(
|
||||
@@ -113,5 +113,4 @@ watch(current, (new_current, old_current) => {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
|
||||
export default { putCommas, doThat, readQueue, current, queue, next, prev };
|
||||
|
||||
Reference in New Issue
Block a user