电子18.2桌面capturer在Ubuntu 22 LTS和Fedora 34

发布于 2025-01-28 05:49:59 字数 1001 浏览 3 评论 0 原文

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

感谢您在进步

desktopCapturer.getSources({ types: ['screen'] }).then( sources => {
  fs.writeFile(`screenshot.jpg`, sources[0].thumbnail.toJPEG(25), (err) => {
    if (err) throw err
      console.log('Image Saved')
  })
})

The above code was tested and working in ubuntu 18 and 20.
But its not working in Ubuntu 22 LTS and Fedora 34.
I have tested the app in electron 17. Screenshot image generated is empty and not working (size is 0 kb)

app.commandLine.appendSwitch('enable-features', 'WebRTCPipeWireCapturer');

I have also enable WebRTCPipeWireCapturer at runtime in main.js

https://gitlab.com/seantaylor/electron-17-desktopcapturer-not-working

I have added entire code in above repository.
Please check the readme file for setup Instructions and running the application.

I have also raised a ticket in electron github, but got no solution.
https://github.com/electron/electron/issues/33961

Thank you in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

饮湿 2025-02-04 05:49:59

找到的解决方案。
在Ubuntu中禁用Wayland可以解决这个问题。

Found solution.
Disabling wayland in ubuntu solves the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文