remove mpv instance validation from system resume reload in case process was closed

This commit is contained in:
jeffvli
2026-08-07 22:08:26 -07:00
parent de07ea7b2f
commit 7b643c7379
2 changed files with 7 additions and 5 deletions
+2 -4
View File
@@ -773,10 +773,8 @@ const cleanupMpv = async (force = false) => {
// the renderer to reload mpv so it reconnects with a fresh stream instead of staying // the renderer to reload mpv so it reconnects with a fresh stream instead of staying
// stuck on the old, now-dead connection until the app is manually restarted. // stuck on the old, now-dead connection until the app is manually restarted.
powerMonitor.on('resume', () => { powerMonitor.on('resume', () => {
if (getMpvInstance()) { mpvLog({ action: 'System resumed from sleep, notifying renderer to reconnect mpv' });
mpvLog({ action: 'System resumed from sleep, reloading mpv' }); getMainWindow()?.webContents.send('renderer-mpv-reconnect');
getMainWindow()?.webContents.send('renderer-mpv-reconnect');
}
}); });
app.on('before-quit', async (event) => { app.on('before-quit', async (event) => {
@@ -69,10 +69,14 @@ export const MpvPlayerEngine = (props: MpvPlayerEngineProps) => {
setReloadTrigger((prev) => prev + 1); setReloadTrigger((prev) => prev + 1);
}; };
const handleMpvReconnect = () => {
handleMpvReload();
};
eventEmitter.on('MPV_RELOAD', handleMpvReload); eventEmitter.on('MPV_RELOAD', handleMpvReload);
// The main process notifies us after the OS resumes from sleep, since the // The main process notifies us after the OS resumes from sleep, since the
// stream mpv had open is likely on a now-dead connection. // stream mpv had open is likely on a now-dead connection.
mpvPlayerListener?.rendererMpvReconnect(handleMpvReload); mpvPlayerListener?.rendererMpvReconnect(handleMpvReconnect);
return () => { return () => {
eventEmitter.off('MPV_RELOAD', handleMpvReload); eventEmitter.off('MPV_RELOAD', handleMpvReload);