Force quit mpv on app close (#4)

This commit is contained in:
jeffvli 2022-12-25 00:56:16 -08:00
parent b6fd3a4f66
commit 4614358163
4 changed files with 34 additions and 6 deletions

View file

@ -44,7 +44,7 @@ const mpv = new MpvAPI(
);
mpv.start().catch((error) => {
console.log('error', error);
console.log('error starting mpv', error);
});
mpv.on('status', (status) => {
@ -152,10 +152,14 @@ ipcMain.on('player-auto-next', async (_event, data: PlayerData) => {
// Sets the volume to the given value (0-100)
ipcMain.on('player-volume', async (_event, value: number) => {
mpv.volume(value);
await mpv.volume(value);
});
// Toggles the mute status
ipcMain.on('player-mute', async () => {
mpv.mute();
await mpv.mute();
});
ipcMain.on('player-quit', async () => {
await mpv.quit();
});