getUserMedia can be very... peculiar currently in most browsers, electron included.

First, make sure you are using your constraints correctly. To get 4k you should be trying something similar to this:

{ audio: false, video: { width: { exact: 3840 }, height: { exact: 2160 } } }

Then if that works, go from there on toning down the constraints to get other non-UHD webcams to work. Make sure you read up on the constraints and what is possible here, and always include the WebRTC adapter.js even in the latest version of electron it is still needed (mainly for converstion of error names to the proper "standard" ones).

Most likely you will end up with a constraints setup similar to this:

{ audio: false, video: { width: { min: 1280, ideal: 3840, max: 3840 }, height: { min: 720, ideal: 2160, max: 2160 } } }

That will make the browser attempt to get a 4k resolution, but then will step down to a minimum of 720p if needed.

Also, if you want to check if your browser/camera supports UHD correctly, you can always try this website which will run a test to get which resolutions getUserMedia supports on your system.