How can I use sceencapturekit to allow on screenshot only selected app or single app?

Generated on 9/6/2024

1 search

To capture only a specific app or window using ScreenCaptureKit, you can utilize the SCStream and SCContentFilter. The SCStream is the object used to receive screen and audio samples in your app, and you can specify what to capture by providing an SCContentFilter. This allows you to capture an entire screen or just specific windows and apps.

Here's a brief overview of how you can achieve this:

  1. Set up an SCStream: This is the object that will handle the screen and audio samples.
  2. Use SCContentFilter: Specify the content you want to capture, such as a specific app or window.
  3. Customize the Stream: If needed, use SCStreamConfiguration to customize the stream's output, like setting a different resolution or pixel format.

For more detailed information, you can refer to the session Capture HDR content with ScreenCaptureKit (00:00:56) from WWDC 2024.