feat(macos/capture): support for capture display other than main display (#2449)
This commit is contained in:
@@ -23,13 +23,24 @@
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
[result addObject:@{
|
||||
@"id": [NSNumber numberWithUnsignedInt:displays[i]],
|
||||
@"name": [NSString stringWithFormat:@"%d", displays[i]]
|
||||
@"name": [NSString stringWithFormat:@"%d", displays[i]],
|
||||
@"displayName": [self getDisplayName:displays[i]],
|
||||
}];
|
||||
}
|
||||
|
||||
return [NSArray arrayWithArray:result];
|
||||
}
|
||||
|
||||
+ (NSString *)getDisplayName:(CGDirectDisplayID)displayID {
|
||||
NSScreen *screens = [NSScreen screens];
|
||||
for (NSScreen *screen in screens) {
|
||||
if (screen.deviceDescription[@"NSScreenNumber"] == [NSNumber numberWithUnsignedInt:displayID]) {
|
||||
return screen.localizedName;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)initWithDisplay:(CGDirectDisplayID)displayID frameRate:(int)frameRate {
|
||||
self = [super init];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user