diff --git a/src/main/features/core/player/index.ts b/src/main/features/core/player/index.ts index 922f84e46..cb012a9fa 100644 --- a/src/main/features/core/player/index.ts +++ b/src/main/features/core/player/index.ts @@ -773,10 +773,8 @@ const cleanupMpv = async (force = false) => { // 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. powerMonitor.on('resume', () => { - if (getMpvInstance()) { - mpvLog({ action: 'System resumed from sleep, reloading mpv' }); - getMainWindow()?.webContents.send('renderer-mpv-reconnect'); - } + mpvLog({ action: 'System resumed from sleep, notifying renderer to reconnect mpv' }); + getMainWindow()?.webContents.send('renderer-mpv-reconnect'); }); app.on('before-quit', async (event) => { diff --git a/src/renderer/features/player/audio-player/engine/mpv-player-engine.tsx b/src/renderer/features/player/audio-player/engine/mpv-player-engine.tsx index 14caf4dfc..54245dba0 100644 --- a/src/renderer/features/player/audio-player/engine/mpv-player-engine.tsx +++ b/src/renderer/features/player/audio-player/engine/mpv-player-engine.tsx @@ -69,10 +69,14 @@ export const MpvPlayerEngine = (props: MpvPlayerEngineProps) => { setReloadTrigger((prev) => prev + 1); }; + const handleMpvReconnect = () => { + handleMpvReload(); + }; + eventEmitter.on('MPV_RELOAD', handleMpvReload); // The main process notifies us after the OS resumes from sleep, since the // stream mpv had open is likely on a now-dead connection. - mpvPlayerListener?.rendererMpvReconnect(handleMpvReload); + mpvPlayerListener?.rendererMpvReconnect(handleMpvReconnect); return () => { eventEmitter.off('MPV_RELOAD', handleMpvReload);