-
Notifications
You must be signed in to change notification settings - Fork 15.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chrome.desktopCapture API #1380
Comments
+1 especially https://developer.chrome.com/extensions/tabCapture |
+1 |
3 similar comments
+1 |
+1 |
👍 |
Would love to see this implemented! |
If anyone is interested in taking this on, we'd be willing to sponsor someone to work on this, get in touch with me if that sounds like an interesting challenge 😄 There is a lot of reference code in nw.js as they have already implemented this feature, albeit with some questionable api design choices. |
+1 |
1 similar comment
+1 |
I will take this issue. But before implementation, some details of the API design are needed to be disscussed. There are two options we can provide in Electron as far as I can see:
mainWindow.webContents.chooseDesktopMedia(["screen", "window"], function(error, desktopId) {
if (error) {
console.log('Desktop Capture access rejected.');
return;
}
navigator.webkitGetUserMedia({
audio: false,
video: {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: desktopId,
minWidth: 1280,
maxWidth: 1280,
minHeight: 720,
maxHeight: 720
}
}
}, gotStream, getUserMediaError);
});
var screenCapture = win.webContents.getMediaList(["window", "screen"]);
screenCapture.on('source-add', function(item) {
// item.name: the name of captured screen/window shown to the user
// item.image: the thumbnail NativeImage of captured screen/window.
// item.id: the id of captured screen/window used in navigator.webkitGetUserMedia
if (item.name == 'Electron') {
navigator.webkitGetUserMedia({
audio: false,
video: {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: item.id,
minWidth: 1280,
maxWidth: 1280,
minHeight: 720,
maxHeight: 720
}
}
}, gotStream, getUserMediaError);
}
});
screenCapture.on('source-change', function(item) {});
screenCapture.on('source-remove', function(item) {}); Compared to option 1, option 2 provides the possibility of custumization to users of Electron(They can do whaterver they need, e.g. implement a customized dialog, and select a fixed window in code). On the other side, user are benefited from the nice Chromium picker dialog in option 1, but they also loose customization in cost. We would like to hear the feedbacks from users. Suggestions are welcomed 😄 |
I think most Electron based apps visually 'pretend' not to be a browser, rey.sc On Tue, Sep 29, 2015 at 11:27 PM, Haojian Wu notifications@github.com
|
Option 2 makes more sense to me, you can always use the information in a JS-based API to build that picker |
Another advantage of Option 2 is that you could add cleverness, like adding a shortcut to share the same screen as you previously shared or defaulting to it. The implementation could end up even nicer than Chrome's. Gets my vote 👍 |
All about option 2 here. If it's implemented in a way that the picker from option 1 could be created in userland, it's a win-win. |
+1 |
5 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
Hey Guys, |
Hi @Raj123456788 — Can you open a new issue describing your problem, the operating system you're using and version of Electron? If you can also provide code that can be used to reproduce your issue that would be spectacular. Thanks, that will help us get to the root of your issue ✨ |
Done!! |
Can anyone please answer this question: #4432 |
Now that W3C, Chrome, Firefox are converging on using getDisplayMedia as a standard, could be worth implementing a native dialog shimming that on top of this existing module no? |
FYI when Electron updates to Chrome 70, we should get getdisplaymedia automatically when using experimental features. |
See #16513 |
Currently in Chromium there is only support for capturing the entire desktop (using getUserMedia with
chromeMediaSource: "screen"
. I looked at the Chromium issue tracker and I can't find anything on the roadmap for better sharing granularity (e.g. to only share 1 app window instead of the entire screen). In Chrome there is a much nicerdesktopCapture
API that implements this really nice popup UI as well as per-OS-window or per-browser-tab or entire screen sharing.This is probably a longshot, but how hard would it be to add the desktopCapture Chrome Platform API to Atom Shell? I can't even find the google repo where desktopCapture is implemented...
The text was updated successfully, but these errors were encountered: