电子18.2桌面capturer在Ubuntu 22 LTS和Fedora 34
desktopCapturer.getSources({ types: ['screen'] }).then( sources => {
fs.writeFile(`screenshot.jpg`, sources[0].thumbnail.toJPEG(25), (err) => {
if (err) throw err
console.log('Image Saved')
})
})
上述代码在Ubuntu 18和20中进行了测试和工作。 但是它在Ubuntu 22 Lts和Fedora 34中不起作用。 我已经在电子17中测试了该应用程序。生成的屏幕截图图像是空的,并且不起作用(大小为0 kb),
app.commandLine.appendSwitch('enable-features', 'WebRTCPipeWireCapturer');
我还在main.js
https://gitlab.com/seantaylor/electron-17-desktopcapturer-not-working
我在上述repository中添加了整个代码。 请检查读书文件中的设置说明并运行应用程序。
我还在Electron Github筹集了一张票,但没有解决方案。 https://github.com/electron/electron/electron/electron/issues/33961
感谢您在进步
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到的解决方案。
在Ubuntu中禁用Wayland可以解决这个问题。
Found solution.
Disabling wayland in ubuntu solves the issue.