Fix second song on startup not playing

This commit is contained in:
jeffvli 2023-10-05 21:54:11 -07:00
parent 6bac172bbe
commit 5e1059870c

View file

@ -114,16 +114,14 @@ ipcMain.on('player-set-queue', async (_event, data: PlayerData, pause?: boolean)
if (data.queue.current) { if (data.queue.current) {
getMpvInstance() getMpvInstance()
?.load(data.queue.current.streamUrl, 'replace') ?.load(data.queue.current.streamUrl, 'replace')
.then(() => {
// eslint-disable-next-line promise/always-return
if (data.queue.next) {
getMpvInstance()?.load(data.queue.next.streamUrl, 'append');
}
})
.catch((err) => { .catch((err) => {
console.log('MPV failed to load song', err); console.log('MPV failed to load song', err);
getMpvInstance()?.play(); getMpvInstance()?.play();
}); });
if (data.queue.next) {
getMpvInstance()?.load(data.queue.next.streamUrl, 'append');
}
} }
} catch (err) { } catch (err) {
console.error(err); console.error(err);