зеркало из https://github.com/electron/electron.git
feat: add getNativePickerSource() API option
This commit is contained in:
Родитель
ec13e9f318
Коммит
b55ce359f4
|
@ -15,6 +15,27 @@ function isValid (options: Electron.SourcesOptions) {
|
|||
|
||||
export { isDisplayMediaSystemPickerAvailable };
|
||||
|
||||
export async function getNativePickerSource () {
|
||||
if (process.platform !== 'darwin') {
|
||||
throw new Error('Native system picker option is currently only supported on MacOS');
|
||||
}
|
||||
|
||||
if (!isDisplayMediaSystemPickerAvailable) {
|
||||
throw new Error(`Native system picker unavailable.
|
||||
Note: This is an experimental API; please check the API documentation for updated restrictions`);
|
||||
}
|
||||
|
||||
// Pass in the needed options for a more native experience
|
||||
// screen & windows by default, no thumbnails, since the native picker doesn't return them
|
||||
const options: Electron.SourcesOptions = {
|
||||
types: ['screen', 'window'],
|
||||
thumbnailSize: { width: 0, height: 0 },
|
||||
fetchWindowIcons: false
|
||||
};
|
||||
|
||||
return await getSources(options);
|
||||
}
|
||||
|
||||
export async function getSources (args: Electron.SourcesOptions) {
|
||||
if (!isValid(args)) throw new Error('Invalid options');
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include "base/containers/flat_map.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
|
@ -421,7 +420,6 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
|
|||
if (capture_screen_ &&
|
||||
list->GetMediaListType() == DesktopMediaList::Type::kScreen) {
|
||||
capture_screen_ = false;
|
||||
base::debug::StackTrace().Print();
|
||||
std::vector<DesktopCapturer::Source> screen_sources;
|
||||
screen_sources.reserve(list->GetSourceCount());
|
||||
for (int i = 0; i < list->GetSourceCount(); i++) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче