我有一个网络电子应用程序,我想在其中一个页面中实现摄像头.
I have a web electron application and I want to implement camera in one of the pages.
问题是最近出于安全原因,网络摄像头只能通过https"访问.但是对于在本地提供应用程序的 Electron 应用程序,方案是不同的,因此流式传输失败.所以我的问题是:
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:
有什么好的解决方案可以在电子内部实现网络摄像头吗?
如果不行,除了网络摄像头还有什么解决方案可行?
我正在回答我自己的问题,以防它帮助其他人.在我的情况下,a 有一个自定义方案,而不是标准方案,即 file 但我遗漏了一些东西.我发现我只需要在 registerStandardSchemes(版本 4)中添加:{ secure: true }.这让 electron 知道这个方案是安全的,并且足以让网络摄像头工作.
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.
查看电子文档以获得更多帮助
这篇关于如何在电子应用程序中访问相机/网络摄像头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 Electron 渲染器进程中创建子窗口时如何修复How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器进程中创建子窗口
mainWindow.loadURL("https://localhost:3000/") 在 EmainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 应用程
Electron webContents executeJavaScript:无法在第二个 loaElectron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:无法在第二个 loadURL 上
如何在angular-cli的组件内使用电子浏览器窗口?how to use electron browser window inside components in angular-cli?(如何在angular-cli的组件内使用电子浏览器窗口?)
ElectronJS - 在 Windows 之间共享 redux 存储?ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之间共享 redux 存储?)
如何通过电子应用程序中的 navigator.geolocation 获取How to getCurrentPosition via navigator.geolocation in Electron app?(如何通过电子应用程序中的 navigator.geolocation 获取当前位置?)