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