mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-19 17:06:38 +02:00
fix: recover mpv playback after the OS resumes from sleep (#2172)
mpv/ffmpeg had no network-level timeout or reconnect options, so a network stream left open across a system sleep would block forever on the now-dead TCP connection instead of failing or reconnecting. Since Node-MPV's IPC commands only resolve when mpv replies, a wedged mpv process also made quit()/restart hang indefinitely, so the only way out was to kill the whole app. - Add --network-timeout and ffmpeg reconnect options to mpv's default parameters so a stalled stream fails fast instead of hanging. - Make the quit() helper resilient to an unresponsive mpv process by racing it against a timeout and force-killing as a fallback. - Listen for Electron's powerMonitor 'resume' event and tell the renderer to reload mpv, so playback recovers automatically instead of requiring a manual app restart.
This commit is contained in:
@@ -174,6 +174,10 @@ const rendererPlayerFallback = (cb: (data: boolean) => void) => {
|
||||
ipcRenderer.on('renderer-player-fallback', (_, data) => cb(data));
|
||||
};
|
||||
|
||||
const rendererMpvReconnect = (cb: () => void) => {
|
||||
ipcRenderer.on('renderer-mpv-reconnect', () => cb());
|
||||
};
|
||||
|
||||
export const mpvPlayer = {
|
||||
autoNext,
|
||||
cleanup,
|
||||
@@ -205,6 +209,7 @@ export const mpvPlayerListener = {
|
||||
rendererAutoNext,
|
||||
rendererCurrentTime,
|
||||
rendererError,
|
||||
rendererMpvReconnect,
|
||||
rendererNext,
|
||||
rendererPause,
|
||||
rendererPlay,
|
||||
|
||||
Reference in New Issue
Block a user