ScreenCaptureKit sample initially omits application with NSWindowSharingType NSWindowSharingNone

The ScreenCaptureKit sample application (https://developer.apple.com/documentation/screencapturekit/capturing-screen-content-in-macos) uses a filter initially set to capture content from the selected display, excluding only the sample application, and excepting no windows:

private var contentFilter: SCContentFilter {
        var filter: SCContentFilter
        switch captureType {
        case .display:
            guard let display = selectedDisplay else { fatalError("No display selected.") }
            
            var excludedApps = [SCRunningApplication]()
            // If a user chooses to exclude the app from the stream,
            // exclude it by matching its bundle identifier.
            if isAppExcluded {
                excludedApps = availableApps.filter { app in
                    Bundle.main.bundleIdentifier == app.bundleIdentifier
                }
            }
            // Create a content filter with excluded apps.
            filter = SCContentFilter(display: display,
                                     excludingApplications: excludedApps,
                                     exceptingWindows: [])
.......
       return filter

However, if another application uses the legacy NSWindowSharingType NSWindowSharingNone attribute, that application is initially not included in the captured stream. Only by toggling either the "Capture Type" or "Exclude sample from stream" checkbox does the initially hidden application become visible.

Additionally, if the "Stop Capture" button is used followed by "Start Capture", the application using the legacy NSWindowSharingType NSWindowSharingNone attribute is once again hidden from the stream, and is only made visible by toggling either the "Capture Type" or "Exclude sample from stream" checkbox.

Does some additional filter element or other SCStream configuration need to be included to verify that all applications, regardless of NSWindowSharingType, are captured using ScreenCaptureKit without requiring manual user interaction/filter refreshing? It seems odd that QuickTime screen recording (using ScreenCaptureKit) immediately captures an application using the NSWindowSharingNone attribute while the ScreenCaptureKit sample application linked above does not.

See images below showing the stream preview before and after toggling the "Capture Type" or "Exclude sample from stream" checkbox. Images were taken from a QuickTime screen recording during testing.

Answered by DTS Engineer in 867106022

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports.

Bug Reporting: How and Why? has tips on creating your bug report.

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports.

Bug Reporting: How and Why? has tips on creating your bug report.

Thanks for the quick response! I filed a bug report and included the two relevant sample applications, the sysdiagnose log, and a screen recording of the behavior occurring: FB21115847

ScreenCaptureKit sample initially omits application with NSWindowSharingType NSWindowSharingNone
 
 
Q