refactor(plugin): split mpv plugin into modules and trim startup overhead

This commit is contained in:
2026-02-27 21:22:44 -08:00
parent c5d4a67f39
commit 1c70e486fe
20 changed files with 1154 additions and 1886 deletions

View File

@@ -194,15 +194,26 @@ export async function runPlaybackCommand(context: LauncherCommandContext): Promi
}
await new Promise<void>((resolve) => {
if (!state.mpvProc) {
const mpvProc = state.mpvProc;
if (!mpvProc) {
stopOverlay(args);
resolve();
return;
}
state.mpvProc.on('exit', (code) => {
const finalize = (code: number | null | undefined) => {
stopOverlay(args);
processAdapter.setExitCode(code ?? 0);
resolve();
};
if (mpvProc.exitCode !== null && mpvProc.exitCode !== undefined) {
finalize(mpvProc.exitCode);
return;
}
mpvProc.once('exit', (code) => {
finalize(code);
});
});
}