mirror of
https://github.com/AzuraCast/AzuraCast.git
synced 2024-06-14 13:16:37 +00:00
37 lines
871 B
JavaScript
37 lines
871 B
JavaScript
import {defineStore} from "pinia";
|
|
|
|
export const usePlayerStore = defineStore(
|
|
'player',
|
|
{
|
|
state: () => {
|
|
return {
|
|
isPlaying: false,
|
|
current: {
|
|
url: null,
|
|
isStream: true
|
|
}
|
|
};
|
|
},
|
|
actions: {
|
|
toggle(payload) {
|
|
let url = payload.url;
|
|
|
|
if (this.current.url === url) {
|
|
this.current = {
|
|
url: null,
|
|
isStream: true
|
|
};
|
|
} else {
|
|
this.current = payload;
|
|
}
|
|
},
|
|
startPlaying() {
|
|
this.isPlaying = true;
|
|
},
|
|
stopPlaying() {
|
|
this.isPlaying = false;
|
|
}
|
|
}
|
|
}
|
|
);
|