Attempt to fix player unresponsive on first start
This commit is contained in:
parent
2f105956b9
commit
9a43ea0e4a
3 changed files with 9 additions and 8 deletions
|
@ -323,12 +323,15 @@ ipcMain.on('player-set-queue', async (_event, data: PlayerData, pause?: boolean)
|
|||
await getMpvInstance()?.load(data.queue.next.streamUrl, 'append');
|
||||
}
|
||||
}
|
||||
} catch (err: NodeMpvError | any) {
|
||||
mpvLog({ action: `Failed to set play queue` }, err);
|
||||
}
|
||||
|
||||
if (pause) {
|
||||
getMpvInstance()?.pause();
|
||||
await getMpvInstance()?.pause();
|
||||
} else if (pause === false) {
|
||||
// Only force play if pause is explicitly false
|
||||
await getMpvInstance()?.play();
|
||||
}
|
||||
} catch (err: NodeMpvError | any) {
|
||||
mpvLog({ action: `Failed to set play queue` }, err);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -89,8 +89,7 @@ export const PlayQueue = forwardRef(({ type }: QueueProps, ref: Ref<any>) => {
|
|||
|
||||
if (playbackType === PlaybackType.LOCAL) {
|
||||
mpvPlayer!.volume(volume);
|
||||
mpvPlayer!.setQueue(playerData);
|
||||
mpvPlayer!.play();
|
||||
mpvPlayer!.setQueue(playerData, false);
|
||||
}
|
||||
|
||||
play();
|
||||
|
|
|
@ -175,8 +175,7 @@ export const useHandlePlayQueueAdd = () => {
|
|||
|
||||
if (playType === Play.NOW || !hadSong) {
|
||||
mpvPlayer!.pause();
|
||||
mpvPlayer!.setQueue(playerData);
|
||||
mpvPlayer!.play();
|
||||
mpvPlayer!.setQueue(playerData, false);
|
||||
} else {
|
||||
mpvPlayer!.setQueueNext(playerData);
|
||||
}
|
||||
|
|
Reference in a new issue