mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Fix mpv stopping after first playback
- On startup, the first time a song is played, mpv will stop after playback - This adds a loop to the queue handler to automatically retry when failing to add to the queue
This commit is contained in:
parent
7f9de4b180
commit
275d68ec5b
2 changed files with 44 additions and 22 deletions
|
|
@ -168,6 +168,20 @@ export const useHandlePlayQueueAdd = () => {
|
|||
if (!songs) return toast.warn({ message: 'No songs found' });
|
||||
|
||||
const playerData = usePlayerStore.getState().actions.addToQueue(songs, options.play);
|
||||
|
||||
if (playerType === PlaybackType.LOCAL) {
|
||||
if (options.play === Play.NEXT || options.play === Play.LAST) {
|
||||
mpvPlayer.setQueueNext(playerData);
|
||||
}
|
||||
|
||||
if (options.play === Play.NOW) {
|
||||
mpvPlayer.setQueue(playerData);
|
||||
mpvPlayer.play();
|
||||
}
|
||||
}
|
||||
|
||||
play();
|
||||
|
||||
mpris?.updateSong({
|
||||
currentTime: usePlayerStore.getState().current.time,
|
||||
repeat: usePlayerStore.getState().repeat,
|
||||
|
|
@ -176,21 +190,6 @@ export const useHandlePlayQueueAdd = () => {
|
|||
status: 'Playing',
|
||||
});
|
||||
|
||||
if (options.play === Play.NEXT || options.play === Play.LAST) {
|
||||
if (playerType === PlaybackType.LOCAL) {
|
||||
mpvPlayer.setQueueNext(playerData);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.play === Play.NOW) {
|
||||
if (playerType === PlaybackType.LOCAL) {
|
||||
mpvPlayer.setQueue(playerData);
|
||||
mpvPlayer.play();
|
||||
}
|
||||
|
||||
play();
|
||||
}
|
||||
|
||||
// if (fetchId) {
|
||||
// toast.update({
|
||||
// autoClose: 1000,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue