I've been exploring the realm of electron app development and stumbled upon a Youtube tutorial titled Build a Desktop App with Electron... But Should You? which teaches how to create a simple screen recording application. However, I ran into an issue.
Uncaught TypeError: Cannot destructure property 'Menu' of 'remote' as it is undefined. at render.js:9
Below is the snippet of code provided in the tutorial:
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, remote} = require('electron');
const {Menu} = remote;
async function getVideoSources(){
const inputSources = await desktopCapturer.getSources({
types:['window','screen']
});
const videoOptionsMenu = Menu.buildFromTemplate(
inputSources.map(source =>{
return{
label:source.name,
click:()=>selectSource(souce)
}
})
);
videoOptionsMenu.popup();
}
Can anyone identify what mistake I may be making here?