1
const videoElement = document.querySelector('video');
const startBtn = document.querySelector('RecordButton');
const stopBtn = document.querySelector('stoprecordingButton');
//declaring the button videoSelectBtn
const videoSelectBtn = document.getElementById('videoSelectBtn');


//stating what the button will do when it is selected
videoSelectBtn.onclick = getVideoSources;

const{ desktopCapturer,remote } = require('electron')
const{ Menu } = remote;


//Get the 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();
}

hello im new to electron and javascript im coming over from swift and iOS development and im getting a error stating

Uncaught TypeError: Cannot set property 'onclick' of null
    at render.js:12

im not too sure exactly why its null any idea? im thinking when videoSelectBtn.onclick is clicked for some reason its null but im not too sure why anyone familiar with electron please help

Ray Ray
  • 166
  • 9

0 Answers0