fix mpv autoNext and next song replacement behavior (part 2)

This commit is contained in:
jeffvli
2025-12-12 18:44:14 -08:00
parent 29a5fa3f74
commit 578083d994
2 changed files with 24 additions and 19 deletions
+7 -1
View File
@@ -371,8 +371,14 @@ ipcMain.on('player-set-queue', async (_event, current?: string, next?: string, p
// Replaces the queue in position 1 to the given data
ipcMain.on('player-set-queue-next', async (_event, url?: string) => {
try {
const size = await getMpvInstance()?.getPlaylistSize();
if (size && size > 1) {
await getMpvInstance()?.playlistRemove(1);
}
if (url) {
await getMpvInstance()?.load(url, 'append');
getMpvInstance()?.load(url, 'append');
}
} catch (err: any | NodeMpvError) {
mpvLog({ action: `Failed to set play queue` }, err);