Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
Overriding navigator.mediaDevices.getDisplayMedia for Screenshare inside electron

I came accross capture screen with electron when rendering a web site when I needed a solution for enabling screenshare inside my electron app; however the desktopCapturer is always undefined, on my side and the only way I can access; sources is inside the main process;

I would like to know if there is a way to have sources define when I do something like this

let all_sources = undefined
  ipcRenderer.on('SET_SOURCES', (ev, sources) => {
    all_sources = sources
  console.log("The sources are : ", all_sources)
  })

  const wait_function = function() {
    return new Promise(resolve => {
        setTimeout(function() {
        resolve(all_sources);
        }, 4000);
    });
    };

contextBridge.exposeInMainWorld("myCustomGetDisplayMedia", async () => {
  await ipcRenderer.send('GET_SOURCES')
  await wait_function(); // want to make sure all_sources is defined
  const selectedSource = all_sources[0]; // take the Entire Screen just for testing purposes
  return selectedSource;
});

this is inside the preload js script. thanks

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda