首页 > 解决方案 > 电子:分享使用带有 WebRTC 的 desktopCapture 将内容标记为视频流

问题描述

我在 BrowserWindow 中有一个 WebView。Webview 充当嵌入式浏览器。我想使用 WebRTC 进行屏幕共享,其中只有我的 WebView 被共享。

有谁知道,事件 desktop-capturer-get-sources https://electronjs.org/docs/api/web-contents#event-desktop-capturer-get-sources 是为了什么?

标签: webviewelectronwebrtc

解决方案


如果你使用 electron.js 构建你的桌面应用程序,你可以通过 electron 官方文档提供的这个示例

https://electronjs.org/docs/api/desktop-capturer#desktopcapturergetsourcesoptions-callback

输出的行为与 webrtc 中使用的任何音频/视频流相同


推荐阅读