You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, we were going to use the audio hack to prevent the browser window from being throttled, but since the Electron app works on a Linode machine running Ubuntu, it throws an error about not finding any sound cards:
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4248:(_snd_config_evaluate) functionsnd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4248:(_snd_config_evaluate) functionsnd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4248:(_snd_config_evaluate) functionsnd_func_refer returned error: No such file or directory
ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4248:(_snd_config_evaluate) functionsnd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4248:(_snd_config_evaluate) functionsnd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4248:(_snd_config_evaluate) functionsnd_func_refer returned error: No such file or directory
ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
Installing a dummy audio card on a Linode machine seems extremely complicated (something about the Linode kernel not having the necessary features?), so I was wondering if anyone is aware of any alternative hacks to obtain the same result, without requiring a real/fake sound card.
Please note that neither webPreferences.backgroundThrottling, nor the disable-renderer-backgrounding work by themselves to prevent throttling.
Here's the mini test-case I'm using:
varapp=require('electron').app;varBrowserWindow=require('electron').BrowserWindow;app.commandLine.appendSwitch("disable-renderer-backgrounding");app.disableHardwareAcceleration();varwin,main,iteration=0;functionleakke_li(){if(win){win.destroy();}win=newBrowserWindow({width: 20000,height: 20000,webPreferences: {offscreen: true,backgroundThrottling: false},show: false});win.webContents.on('did-finish-load',function(){win.webContents.executeJavaScript(`(function(){ // Start a silent audio source in the web page // to prevent it from being throttled in the background // by an overzealous Chromium. // Reference: https://github.com/atom/atom/pull/9485/files var context = new AudioContext(); var source = context.createBufferSource(); source.connect(context.destination); source.start(0); })()`,function(){console.log('apply audio hack');});console.log('event:did-finish-load',++iteration);win.webContents.once('paint',function(event,dirty,image){console.log('event:paint');setTimeout(leakke_li,300);});win.webContents.invalidate();});win.loadURL('about:blank');}app.on('ready',function(){varmain=newBrowserWindow({width: 10,height: 10,webPreferences: {backgroundThrottling: false}});leakke_li();});
(With the caveat that I can provide no warranties about what it does to the machine, exercise caution. Reference)
Possible alternative?
On Mac, I've had some success with controlling the focus of the windows through window.focus() / app.focus(), but I'm not sure how focus management works with an Electron running with xvfb in a headless Ubuntu, so any pointers in this direction are much appreciated.
The text was updated successfully, but these errors were encountered:
Electron version: 1.4.3
Hi there, we were going to use the audio hack to prevent the browser window from being throttled, but since the Electron app works on a Linode machine running Ubuntu, it throws an error about not finding any sound cards:
Installing a dummy audio card on a Linode machine seems extremely complicated (something about the Linode kernel not having the necessary features?), so I was wondering if anyone is aware of any alternative hacks to obtain the same result, without requiring a real/fake sound card.
Please note that neither
webPreferences.backgroundThrottling
, nor thedisable-renderer-backgrounding
work by themselves to prevent throttling.Here's the mini test-case I'm using:
(It's a riff on the code in #7350)
Note for posterity: On a normal Ubuntu Server machine, getting a dummy sound card to make the Audio hack to work is as follows:
(With the caveat that I can provide no warranties about what it does to the machine, exercise caution. Reference)
Possible alternative?
On Mac, I've had some success with controlling the focus of the windows through
window.focus()
/app.focus()
, but I'm not sure how focus management works with an Electron running with xvfb in a headless Ubuntu, so any pointers in this direction are much appreciated.The text was updated successfully, but these errors were encountered: