无法获取桌面选择器对话框@electron [英] Unable to obtain desktop picker dialog @electron
问题描述
我无法获取可用资源的桌面选择器对话框。我是新手,有人可以指导我我所缺少的吗?在chrome中,我们使用 chrome.desktopCapture.chooseDesktopMedia吗?我从下面的代码中获取了源代码。
I am unable to get desktop picker dialog for available sources. I am newbie can someone guide me what am I missing? In chrome we use "chrome.desktopCapture.chooseDesktopMedia"? I obtained source from below code.
function onAccessApproved(error, sources) {
if (error) throw error;
for (var i = 0; i < sources.length; ++i) {
{
navigator.webkitGetUserMedia({
audio: false,
video: {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: sources[i].id,
minWidth: 1280,
maxWidth: 1280,
minHeight: 720,
maxHeight: 720
}
}
}, gotShareStream, errorCallback);
return;
}
我已经尝试了选项链接,但是我收到了BrowserWindow未定义错误。
I have tried Option link but I am getting BrowserWindow undefined error.
谢谢!
推荐答案
我没用过电子,但是在WebRTC中,您需要使用以下视频:{可选:[{sourceId:source.id}]}
。并且不要对所有来源都这样做-仅这样做是为了从该来源获取流。
I haven't used electron, but in WebRTC you need to use something like this video: {optional: [{sourceId: source.id}]}
. And don't do this for all the sources - do this only to get a stream from that source.
要获取可用来源,请使用 navigator.mediaDevices.enumerateDevices()
,然后按种类
进行过滤,可以是音频输入
,音频输出
,视频输入
和视频输出
。
To get the available sources use navigator.mediaDevices.enumerateDevices()
and then filter them by kind
which can be audioinput
, audiooutput
, videoinput
and videooutput
.
这篇关于无法获取桌面选择器对话框@electron的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!