mirror of
https://github.com/jeffvli/feishin.git
synced 2026-08-08 13:23:16 +02:00
remove mpv instance validation from system resume reload in case process was closed
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user