javascript - How to access camerawebcamera inside electron app? - Stack Overflow

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

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?

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?

Share Improve this question asked Mar 7, 2019 at 13:55 Herbi ShtiniHerbi Shtini 2,04029 silver badges34 bronze badges 4
  • When I search for "electron camera," I get a lot of relevant results. (This and this are in the first five, for instance.) Did they not show up in your searching? Or was there some problem applying what they demonstrate? – T.J. Crowder Commented Mar 7, 2019 at 14:02
  • @T.J.Crowder No actually I have seen a lot of them(both your links) but as I have mentioned the required secure connection has been introduced lately. It will work fine in development(localhost) but not on production and that is because of the protocol – Herbi Shtini Commented Mar 7, 2019 at 14:05
  • If you're saying it used to work and now it doesn't because of a new requirement for HTTPS, I don't see a bug for that unless it's this one. If so, it's an open bug, not sure you'll be able to do much until it's fixed. – T.J. Crowder Commented Mar 7, 2019 at 14:16
  • @T.J.Crowder actually I tested it and it will work with 'file' scheme but we have configured a custom scheme and with that is not working not sure what is missing though – Herbi Shtini Commented Mar 7, 2019 at 14:19
Add a ment  | 

1 Answer 1

Reset to default 5

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744999581a4605410.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信