addClipBufferingOutput
NewiOSmacOStvOSopen func addClipBufferingOutput(_ clipBufferingOutput: SCClipBufferingOutput) throwsWhat's New / Media, Audio & Capture
ScreenCaptureKit captures screen, window, and audio content on Apple platforms. It includes picker UI for choosing what to share and delivers stream output to the app.
72 new APIs, no deprecations or removals. New types include the SCStreamError struct with its Code enum (cases insufficientStorage, notSupported, missingBackgroundMode), the SCRecordingOutputDelegate, SCRecordingEditorDelegate, SCClipBufferingOutputDelegate, and SCContentSharingPickerObserver protocols, and the enums SCShareableContentStyle, SCStreamOutputType, SCFrameStatus, SCCaptureDynamicRange, and Preset. New entry points cover SCContentSharingPicker presentation (present, presentForCurrentApplication, isAvailable), the SCStreamErrorDomain, and the SCStreamFrameInfo struct.
addClipBufferingOutputopen func addClipBufferingOutput(_ clipBufferingOutput: SCClipBufferingOutput) throwsaddRecordingOutputopen func addRecordingOutput(_ recordingOutput: SCRecordingOutput) throwsaddVideoEffectOutputopen func addVideoEffectOutput(_ videoEffectOutput: SCVideoEffectOutput) throwscaptureDynamicRangeopen var captureDynamicRange: SCCaptureDynamicRangecapturesAudioopen var capturesAudio: BoolchannelCountopen var channelCount: IntcontentRectopen var contentRect: CGRect { get }excludesCurrentProcessAudioopen var excludesCurrentProcessAudio: Boolheightopen var height: Intinitpublic convenience init(preset: SCStreamConfiguration.Preset)isAvailableopen var isAvailable: Bool { get }isCameraEnabledopen var isCameraEnabled: Bool { get }isCapturingopen var isCapturing: Bool { get }isMicrophoneEnabledopen var isMicrophoneEnabled: Bool { get }mixesAudioWithMicrophoneopen var mixesAudioWithMicrophone: BoolpointPixelScaleopen var pointPixelScale: Float { get }presentopen func present()presentopen func present(using contentStyle: SCShareableContentStyle)presentopen func present(from windowScene: UIWindowScene, completionHandler: @escaping @Sendable ((any Error)?) -> Void)presentopen func present(from windowScene: UIWindowScene) async throwspresentopen func present(from window: NSWindow, completionHandler: @escaping @Sendable ((any Error)?) -> Void)presentopen func present(from window: NSWindow) async throwspresentopen func present(from windowScene: UIWindowScene, mode: SCRecordingEditor.Mode, completionHandler: @escaping @Sendable ((any Error)?) -> Void)presentopen func present(from windowScene: UIWindowScene, mode: SCRecordingEditor.Mode) async throwspresentForCurrentApplicationopen func presentForCurrentApplication()removeClipBufferingOutputopen func removeClipBufferingOutput(_ clipBufferingOutput: SCClipBufferingOutput) throwsremoveRecordingOutputopen func removeRecordingOutput(_ recordingOutput: SCRecordingOutput) throwsremoveVideoEffectOutputopen func removeVideoEffectOutput(_ videoEffectOutput: SCVideoEffectOutput) throwssampleRateopen var sampleRate: IntSCCaptureDynamicRangepublic enum SCCaptureDynamicRange : Int, @unchecked Sendablepublic enum SCCaptureDynamicRange : Int, @unchecked Sendable {
case SDR = 0
case hdrCanonicalDisplay = 2
}SCClipBufferingOutputDelegatepublic protocol SCClipBufferingOutputDelegate : NSObjectProtocolpublic protocol SCClipBufferingOutputDelegate : NSObjectProtocol {
/**
@abstract clipBufferingOutputDidStartBuffering:
@param clipBufferingOutput the SCClipBufferingOutput object
@discussion Notifies the delegate that clip buffering has successfully started.
*/
optional func clipBufferingOutputDidStartBuffering(_ clipBufferingOutput: SCClipBufferingOutput)
/**
@abstract clipBufferingOutput:didFailWithError:
@param clipBufferingOutput the SCClipBufferingOutput object
@param error error describing why clip buffering failed
@discussion Notifies the delegate that clip buffering has failed with an associated error.
*/
optional func clipBufferingOutput(_ clipBufferingOutput: SCClipBufferingOutput, didFailWithError error: any Error)
/**
@abstract clipBufferingOutputDidStopBuffering:
@param clipBufferingOutput the SCClipBufferingOutput object
@discussion Notifies the delegate that clip buffering has finished successfully.
*/
optional func clipBufferingOutputDidStopBuffering(_ clipBufferingOutput: SCClipBufferingOutput)
}SCContentSharingPickerextension SCContentSharingPickerextension SCContentSharingPicker {
public var configuration: SCContentSharingPickerConfiguration?
public var defaultConfiguration: SCContentSharingPickerConfiguration
public func setConfiguration(_ configuration: SCContentSharingPickerConfiguration?, for stream: SCStream)
}SCContentSharingPickerConfigurationpublic struct SCContentSharingPickerConfigurationpublic struct SCContentSharingPickerConfiguration {
@available(iOS 27.0, *)
@available(macOS, unavailable)
@available(macCatalyst, unavailable)
@available(tvOS, unavailable)
public var showsMicrophoneControl: Bool
@available(iOS 27.0, *)
@available(macOS, unavailable)
@available(macCatalyst, unavailable)
@available(visionOS, unavailable)
public var showsCameraControl: Bool
public init()
}SCContentSharingPickerObserverpublic protocol SCContentSharingPickerObserver : NSObjectProtocolpublic protocol SCContentSharingPickerObserver : NSObjectProtocol {
/**
@abstract contentSharingPicker:didCancelforStream:
@param picker the SCContentSharingPicker object
@param stream the optional associated stream for this picker
@discussion the observer callback method when the picker has been canceled with no selection.
*/
func contentSharingPicker(_ picker: SCContentSharingPicker, didCancelFor stream: SCStream?)
/**
@abstract contentSharingPicker:didUpdateWithFilter:forStream:
@param picker the SCContentSharingPicker object
@param filter the updated filter
@param stream the updated stream
@discussion the observer callback method when the user has finished updating content for a stream
*/
func contentSharingPicker(_ picker: SCContentSharingPicker, didUpdateWith filter: SCContentFilter, for stream: SCStream?)
/**
@abstract contentSharingPickerStartDidFailWithError:
@param error the error denoted for the failure to start picker
@discussion the observer callback method when the picker was asked to start but failed to do so.
*/
func contentSharingPickerStartDidFailWithError(_ error: any Error)
}SCFrameStatuspublic enum SCFrameStatus : Int, @unchecked Sendablepublic enum SCFrameStatus : Int, @unchecked Sendable {
case complete = 0
case idle = 1
case blank = 2
case suspended = 3
case started = 4
case stopped = 5
}SCRecordingEditorDelegatepublic protocol SCRecordingEditorDelegate : NSObjectProtocolpublic protocol SCRecordingEditorDelegate : NSObjectProtocol {
/**
@abstract recordingEditorDidDismiss:
@discussion Called when the recording editor is dismissed.
*/
optional func recordingEditorDidDismiss(_ editor: SCRecordingEditor)
/**
@abstract recordingEditor:didFailWithError:
@discussion Called when the recording editor encounters an error.
*/
optional func recordingEditor(_ editor: SCRecordingEditor, didFailWithError error: any Error)
}SCRecordingOutputDelegatepublic protocol SCRecordingOutputDelegate : NSObjectProtocolpublic protocol SCRecordingOutputDelegate : NSObjectProtocol {
/**
@abstract recordingOutputDidStartRecording:
@param recordingOutput the SCRecordingOutput object
@discussion notifies the delegate that recording has succesfully started.
*/
optional func recordingOutputDidStartRecording(_ recordingOutput: SCRecordingOutput)
/**
@abstract recordingOutput:didFailWithError:
@param recordingOutput the SCRecordingOutput object
@param error error describing why the recording failed.
@discussion notifies the delegate that recording has failed with error associated.
*/
optional func recordingOutput(_ recordingOutput: SCRecordingOutput, didFailWithError error: any Error)
/**
@abstract recordingOutputDidFinishRecording:
@discussion notifies the delegate that recording has finished successfully.
*/
optional func recordingOutputDidFinishRecording(_ recordingOutput: SCRecordingOutput)
}SCShareableContentStylepublic enum SCShareableContentStyle : Int, @unchecked Sendablepublic enum SCShareableContentStyle : Int, @unchecked Sendable {
case none = 0
@available(iOS 27.0, *)
case display = 2
}SCStreamDelegatepublic protocol SCStreamDelegate : NSObjectProtocolpublic protocol SCStreamDelegate : NSObjectProtocol {
/**
@abstract stream:didStopStreamWithError:
@param stream the SCStream object
@param error the error denoted by the stopping of the stream
@discussion notifies the delegate that the stream has stopped and the error associated with it
*/
optional func stream(_ stream: SCStream, didStopWithError error: any Error)
/**
@abstract outputVideoEffectDidStartForStream:
@param stream the SCStream object
@discussion notifies the delegate that the stream's overlay video effect has started.
*/
@available(iOS 27.0, *)
optional func outputVideoEffectDidStart(for stream: SCStream)
/**
@abstract outputVideoEffectDidStopForStream:
@param stream the SCStream object
@discussion notifies the delegate that the stream's overlay video effect has stopped.
*/
@available(iOS 27.0, *)
optional func outputVideoEffectDidStop(for stream: SCStream)
/**
@abstract outputVideoEffectDidFailForStream:withError:
@param stream the SCStream object
@param error the error describing why the video effect failed
@discussion Notifies the delegate that the video effect failed with an error. This can occur if the camera device is unavailable, permissions are missing, or an internal error occurs.
*/
@available(iOS 27.0, *)
optional func outputVideoEffectDidFail(for stream: SCStream, withError error: any Error)
/**
@abstract streamDidBecomeActive:
@param stream the SCStream object
@discussion notifies the delegate the first time any window that was being shared in the stream is re-opened after all the windows being shared are closed. When all the windows being shared are closed, the client will receive streamDidBecomeInactive:.
*/
optional func streamDidBecomeActive(_ stream: SCStream)
/**
@abstract streamDidBecomeInactive:
@param stream the SCStream object
@discussion notifies the delegate that all the windows that are currently being shared are exited. This callback occurs for all content filter types.
*/
optional func streamDidBecomeInactive(_ stream: SCStream)
}SCStreamErrorpublic struct SCStreamError : CustomNSError, Hashable, Errorpublic struct SCStreamError : CustomNSError, Hashable, Error {
public init(_nsError: NSError)
public static var errorDomain: String { get }
@available(iOS 27.0, *)
public enum Code : Int, @unchecked Sendable, Equatable {
public typealias _ErrorType = SCStreamError
case userDeclined = -3801
case failedToStart = -3802
case missingEntitlements = -3803
case failedApplicationConnectionInvalid = -3804
case failedApplicationConnectionInterrupted = -3805
case failedNoMatchingApplicationContext = -3806
case attemptToStartStreamState = -3807
case attemptToStopStreamState = -3808
case attemptToUpdateFilterState = -3809
case attemptToConfigState = -3810
case internalError = -3811
case invalidParameter = -3812
case noWindowList = -3813
case noDisplayList = -3814
case noCaptureSource = -3815
case removingStream = -3816
case userStopped = -3817
case failedToStartAudioCapture = -3818
case failedToStopAudioCapture = -3819
case failedToStartMicrophoneCapture = -3820
case systemStoppedStream = -3821
@available(iOS 27.0, *)
case insufficientStorage = -3822
@available(iOS 27.0, *)
case notSupported = -3823
@available(iOS 27.0, *)
case missingBackgroundMode = -3824
}
public static var userDeclined: SCStreamError.Code { get }
public static var failedToStart: SCStreamError.Code { get }
public static var missingEntitlements: SCStreamError.Code { get }
public static var failedApplicationConnectionInvalid: SCStreamError.Code { get }
public static var failedApplicationConnectionInterrupted: SCStreamError.Code { get }
public static var failedNoMatchingApplicationContext: SCStreamError.Code { get }
public static var attemptToStartStreamState: SCStreamError.Code { get }
public static var attemptToStopStreamState: SCStreamError.Code { get }
public static var attemptToUpdateFilterState: SCStreamError.Code { get }Truncated.
SCStreamErrorDomainpublic let SCStreamErrorDomain: StringSCStreamFrameInfopublic struct SCStreamFrameInfo : Hashable, Equatable, RawRepresentable, @unchecked Sendablepublic struct SCStreamFrameInfo : Hashable, Equatable, RawRepresentable, @unchecked Sendable {
public init(rawValue: String)
}SCStreamOutputpublic protocol SCStreamOutput : NSObjectProtocolpublic protocol SCStreamOutput : NSObjectProtocol {
/**
@abstract stream:didOutputSampleBuffer:ofType:
@param sampleBuffer the sample buffer
@param type the sample buffer type
@discussion protocol method for passing back screen sample buffers
*/
optional func stream(_ stream: SCStream, didOutputSampleBuffer sampleBuffer: CMSampleBuffer, of type: SCStreamOutputType)
}SCStreamOutputTypepublic enum SCStreamOutputType : Int, @unchecked Sendablepublic enum SCStreamOutputType : Int, @unchecked Sendable {
case screen = 0
@available(iOS 27.0, *)
case audio = 1
@available(iOS 27.0, *)
case microphone = 2
}styleopen var style: SCShareableContentStyle { get }synchronizationClockopen var synchronizationClock: CMClock? { get }widthopen var width: IntSCContentSharingPickerConfiguration.showsCameraControlpublic var showsCameraControl: BoolSCContentSharingPickerConfiguration.showsMicrophoneControlpublic var showsMicrophoneControl: BoolSCRecordingEditor.Modepublic enum Mode : Int, @unchecked Sendablepublic enum Mode : Int, @unchecked Sendable {
case preview = 0
case share = 1
}SCShareableContentStyle.displaycase display = 2SCStreamConfiguration.Presetpublic enum Preset : Int, @unchecked Sendablepublic enum Preset : Int, @unchecked Sendable {
@available(iOS 27.0, *)
case captureHDRRecordingPreservedSDRHDR10 = 4
}SCStreamConfiguration.Preset.captureHDRRecordingPreservedSDRHDR10case captureHDRRecordingPreservedSDRHDR10 = 4SCStreamDelegate.outputVideoEffectDidFailoptional func outputVideoEffectDidFail(for stream: SCStream, withError error: any Error)SCStreamDelegate.outputVideoEffectDidStartoptional func outputVideoEffectDidStart(for stream: SCStream)SCStreamDelegate.outputVideoEffectDidStopoptional func outputVideoEffectDidStop(for stream: SCStream)SCStreamError.Codepublic enum Code : Int, @unchecked Sendable, Equatablepublic enum Code : Int, @unchecked Sendable, Equatable {
public typealias _ErrorType = SCStreamError
case userDeclined = -3801
case failedToStart = -3802
case missingEntitlements = -3803
case failedApplicationConnectionInvalid = -3804
case failedApplicationConnectionInterrupted = -3805
case failedNoMatchingApplicationContext = -3806
case attemptToStartStreamState = -3807
case attemptToStopStreamState = -3808
case attemptToUpdateFilterState = -3809
case attemptToConfigState = -3810
case internalError = -3811
case invalidParameter = -3812
case noWindowList = -3813
case noDisplayList = -3814
case noCaptureSource = -3815
case removingStream = -3816
case userStopped = -3817
case failedToStartAudioCapture = -3818
case failedToStopAudioCapture = -3819
case failedToStartMicrophoneCapture = -3820
case systemStoppedStream = -3821
@available(iOS 27.0, *)
case insufficientStorage = -3822
@available(iOS 27.0, *)
case notSupported = -3823
@available(iOS 27.0, *)
case missingBackgroundMode = -3824
}SCStreamError.insufficientStoragepublic static var insufficientStorage: SCStreamError.Code { get }SCStreamError.missingBackgroundModepublic static var missingBackgroundMode: SCStreamError.Code { get }SCStreamError.notSupportedpublic static var notSupported: SCStreamError.Code { get }SCStreamError.Code.insufficientStoragecase insufficientStorage = -3822SCStreamError.Code.missingBackgroundModecase missingBackgroundMode = -3824SCStreamError.Code.notSupportedcase notSupported = -3823SCStreamFrameInfo.contentRectpublic static let contentRect: SCStreamFrameInfoSCStreamFrameInfo.contentScalepublic static let contentScale: SCStreamFrameInfoSCStreamFrameInfo.displayTimepublic static let displayTime: SCStreamFrameInfoSCStreamFrameInfo.scaleFactorpublic static let scaleFactor: SCStreamFrameInfoSCStreamFrameInfo.screenRectpublic static let screenRect: SCStreamFrameInfoSCStreamFrameInfo.statuspublic static let status: SCStreamFrameInfoSCStreamFrameInfo.videoOrientationpublic static let videoOrientation: SCStreamFrameInfoSCStreamOutputType.audiocase audio = 1SCStreamOutputType.microphonecase microphone = 2No APIs match your filter.