Hi,
my app ScreenFloat can capture screenshots and record the screen (along with system- and microphone audio). It does this in an XPC service.
On macOS Sequoia b1-3, recording does not work anymore (although permissions are granted to the app in System Preferences > Privacy & Security). Instead, I keep getting an error that my XPC service can access this computer's screen and audio. (of course, that's the point!)
First of all, the screen is locked when the warning appears, clicks anywhere on the screen are not recognized. I have to hit Escape (or wait about a minute, at which point it resolves itself), to be able to click anywhere.
Clicking on Continue To Allow doesn't do anything, either. The warning just re-appears every time.
Do I need to add a new entitlement to my main app or the XPC service, or any new NSUsage strings to the InfoPlist.strings?
How can I resolve this?
Thank you,
Matthias
ScreenCaptureKit
RSS for tagScreenCaptureKit brings high-performance screen capture, including audio and video, to macOS.
Posts under ScreenCaptureKit tag
48 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I tried the ScreenCaptureKit sample code from Apple:
ScreenCaptureKit Sample Code
When I ran it for a while, it crash at the strange position as attached screenshot.
The value array is not empty and has value at index 0 but it crashed.
What framework to use to capture screen of a device connected to the Mac in the way OBS or QuickTime Player does when an iOS device is connected to Mac via USB. I tried to list devices with AVFoundation and ScreenCaptureKit but only Mac camera, mic and displays are listed.
When you select New Movie Recording in the QuickTime Player you can choose an Connected iPad or iPhone to record it's screan. Same with OBS.
What is the way to do it in my own MacOS app?
Hi, recently some users of my app upgrade MacOS to 15, and encounter hang when trying to get screen capture permission. After looking into this issue, I find out a repoducible way. If two processes of a same program both call CGDisplayStreamCreate/CGDisplayImageCreate API, the later one will hang(No need to be at almost same time).
Here are my demo codes.
#import <AVFoundation/AVFoundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
int main(int argc, const char *argv[]) {
@autoreleasepool {
CGDirectDisplayID displayID = CGMainDisplayID();
CGDisplayStreamRef stream = CGDisplayStreamCreate(
displayID, 1, 1, kCVPixelFormatType_32BGRA, nil,
^(CGDisplayStreamFrameStatus status, uint64_t displayTime,
IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef){
});
if (!stream) {
NSLog(@"Failed to create display stream!");
return 1;
} else {
NSLog(@"Create display stream success!");
CFRelease(stream);
}
}
sleep(10);
return 0;
}
The call of sleep is just to ensure I can run a second process of this program before the first one ends. It turns out that the first process checks the permission correctly and sleeps successfully. However the second process won't be able to print anything because it hangs when calling CGDisplayStreamCreate. Here is the output of sample:
Call graph:
2546 Thread_1315735 DispatchQueue_1: com.apple.main-thread (serial)
+ 2546 start (in dyld) + 2840 [0x196f8f274]
+ 2546 main (in testapp) + 76 [0x100ef7e38]
+ 2546 SLDisplayStreamCreate (in SkyLight) + 316 [0x19d38163c]
+ 2546 SLSDisplayStreamCreateProxying (in ScreenCaptureKit) + 816 [0x231e2d614]
+ 2546 _dispatch_semaphore_wait_slow (in libdispatch.dylib) + 76 [0x19715e278]
+ 2546 _dispatch_sema4_timedwait (in libdispatch.dylib) + 64 [0x19715dc78]
+ 2546 semaphore_timedwait_trap (in libsystem_kernel.dylib) + 8 [0x1972ceda8]
2546 Thread_1315737
2546 start_wqthread (in libsystem_pthread.dylib) + 8 [0x19730b0f0]
2546 _pthread_wqthread (in libsystem_pthread.dylib) + 364 [0x19730c424]
2546 __workq_kernreturn (in libsystem_kernel.dylib) + 8 [0x1972d0a64]
If I copy the program and run two different programs, the second program won't hang. This issue doesn't happen on MacOS early version. Can anybody help?
The two ScreenCaptureKit WWDC22 sessions show how to capture with the new framework but the retina factor is hardcoded to 2 in SCStreamConfiguration.
When using on a non-retina display, the screencapture is floating on the upper-left corner of the image buffer.
There does not seem to be a simple way to retrieve the retina factor from the SCShareableContent data (when configuring the capture).
When processing the streaming output, the SCStreamFrameInfo attachment is supposed to have a scaleFactor property but .scaleFactor does not return a value.
I have found out that the attachement dictionary contains SCStreamUpdateFrameDisplayResolution. This entry gives me the retina factor but it is not an official SCStreamFrameInfo key. I list the keys to access it.
What is the proper way with ScreenCapture to handle the retina factors ?
Guys,
In my main application bundle, I have included a helper bundle in its Resources. When the helper requests Accessibility permission, the system modal window displays what the helper is requesting permission for.
However, when the helper requests permission for Screen Recording, the system modal window displays that the main application bundle is requesting permission, which includes the helper.
This issue seems to be specific to Ventura, as both requests are displayed on behalf of the helper in Monterey.
I'm wondering if this is a known issue or limitation or if there is a way to make the permission request specifically from the helper.
I'm creating app that listening other app's sound. in this use case, screen data is not needed.
but if I don't call SCStream#addStreamOutput(_, type: .screen, ...), console shows this error:
[ERROR] _SCStream_RemoteVideoQueueOperationHandlerWithError:701 stream output NOT found. Dropping frame
currently I'm setting SCStreamConfiguration#minimumFrameInterval to large value (e.g. 0.1fps) as workaround, but it would be good if i can completely disable screen capture for best performance.
there is any way to disable screen capture and only captures apps audio?
I'm trying to use ScreenCaptureKit on a Mac Catalyst app, on macOS 12.5.1.
I'm not sure if I'm doing something wrong, but it crashes as soon as I try to request SCShareableContent. It crashes on internal code, calling a method it can't find, which makes me think this is a bug in the framework rather than incorrect configuration.
Any hints on how to work around this problem?
The crash is:
** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RPDaemonProxy fetchShareableContentWithOption:windowID:withCompletionHandler:]: unrecognized selector sent to instance 0x6000037d5dc0'
terminating with uncaught exception of type NSException
ScreenCaptureKit-Crash.txt
Topic:
App & System Services
SubTopic:
General
Tags:
Mac Catalyst
ReplayKit
ScreenCaptureKit
wwdc2022-10155