silent: Reflect changes in webview for silent option. (#380)

* silent: Reflect changes in webview for mute/silent option.

This silent the webview incase silent option is toggled, and
by default silent the webview when its create if needed.

Fixes: #380.
This commit is contained in:
Priyank P
2018-01-11 08:16:39 -05:00
committed by Akash Nimare
parent fb74251a2c
commit 91742a5770
3 changed files with 26 additions and 4 deletions

View File

@@ -277,6 +277,20 @@ class ServerManagerView {
const webContents = webview.getWebContents();
webContents.send('toggle-sidebar', state);
});
ipcRenderer.on('toogle-silent', (event, state) => {
const webviews = document.querySelectorAll('webview');
webviews.forEach(webview => {
try {
webview.setAudioMuted(state);
} catch (err) {
// webview is not ready yet
webview.addEventListener('dom-ready', () => {
webview.isAudioMuted();
});
}
});
});
}
destroyTab(name, index) {