Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access camera/webcamera inside electron app?

I have a web electron application and I want to implement camera in one of the pages.

The problem is that lately for security reasons webcam can only be accessed via 'https'. But in case of an Electron app where the application is served locally the scheme is different and therefore streaming fails. So my question is:

Is there any good solution to implement webcam inside electron?

If not, what solution other than webcam might work?

like image 937
Herbi Shtini Avatar asked Oct 28 '25 12:10

Herbi Shtini


1 Answers

I am answering my own question in case it helps anyone else. In my case a had a custom scheme instead of the standard one which is file but I was missing something. I found out I just had to add: { secure: true } inside registerStandardSchemes(version 4). That makes electron know that this scheme is secure and that is enough for webcam to work.

Look through electron documentation for more help

like image 110
Herbi Shtini Avatar answered Oct 30 '25 02:10

Herbi Shtini