Get camera access from the browser before streaming

In record.a.video, I wanted to list all the cameras and mics before streaming starts. To do this, I call this at window.onload:

navigator.getUserMedia({audio:true,video:true}, function(stream) {
            stream.getTracks().forEach(x=>x.stop());
            getCamAndMics();
          }, err=>console.log(err));

This kicks off a video stream (which prompts the browser for access), and then immediately stops it. The camera light turns on briefly, but turns off as soon as permission is granted.

The getCamAndMics() function now can iterate through all of the cameras and microphones to populate the form:

The code can be found on github: