Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

437
Visualizações
In electron since the 'remote' has been deprecated, what module to use in place of it?

I am trying to make a video recording app using electron js as per this video from fireship - https://youtu.be/3yqDxhR2XxE and I'm stuck at building a selection menu of available video sources, as it turned out that the "remote" module has been deprecated. I have 2 js files, one is index.js which is the main electron js file and the other is the render.js file (in which I'm building functions for my app). I tried importing "remote" module in the index.js file but that didn't work. I even set the enableRemoteModule: true in webPreferences in index.js but that too didn't work. Now I am completely out of ideas as a newbie. I heard about the ipcRenderer and ipcMain modules but not sure they will work.

Below is the code for my "app.js":

//Buttons
const videoElement = document.querySelector('Video');
const startBtn = document.getElementById('startBtn');
const stopBtn = document.getElementById('stopBtn');
const videoSelectBtn = document.getElementById('videoSelectBtn');
videoSelectBtn.onclick = getVideoSources;


const {
  desktopCapturer
} = require("electron");
const {
  remote
} = require('@electron/remote')
const {
  Menu
} = remote


//Getting all available Video Sources
async function getVideoSources() {
  const inputSources = await desktopCapturer.getSources({
    types: ['window', 'screen']
  });

  const videoOptionsMenu = Menu.buildFromTemplate(
    inputSources.map(source => {
      return {
        label: source.name,
        click: () => selectSource(source)
      };
    })
  );

  videoOptionsMenu.popup();
}

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda