Fix video and audio playback to pause on window close
This commit is contained in:
parent
d215e1b9be
commit
96131112da
9 changed files with 98 additions and 1 deletions
12
app/main.ts
12
app/main.ts
|
@ -832,6 +832,12 @@ async function createWindow() {
|
|||
// App dock icon bounce
|
||||
bounce.init(mainWindow);
|
||||
|
||||
mainWindow.on('hide', () => {
|
||||
if (mainWindow && !windowState.shouldQuit()) {
|
||||
mainWindow.webContents.send('set-media-playback-disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
// Emitted when the window is about to be closed.
|
||||
// Note: We do most of our shutdown logic here because all windows are closed by
|
||||
// Electron before the app quits.
|
||||
|
@ -937,6 +943,12 @@ async function createWindow() {
|
|||
}
|
||||
});
|
||||
|
||||
mainWindow.on('show', () => {
|
||||
if (mainWindow) {
|
||||
mainWindow.webContents.send('set-media-playback-disabled', false);
|
||||
}
|
||||
});
|
||||
|
||||
mainWindow.once('ready-to-show', async () => {
|
||||
getLogger().info('main window is ready-to-show');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue