SCCameraKitOutput
Objective-C
@protocol SCCameraKitOutput <NSObject>
Swift
protocol Output : NSObjectProtocol
Allows conformers to be notified of new frame data from CameraKit.
-
Notifies that a new frame is available.
Warning
DO NOT stop or start CameraKit in this output method. This method doesn’t guarantee that CamearKit has finished processing the current frame, so stopping or starting in this method is undefined behavior, which can lead to other outputs getting invalid textures that may crash when drawing the frame or deadlocking the current thread.Declaration
Objective-C
- (void)cameraKit:(nonnull id<SCCameraKitProtocol>)cameraKit didOutputTexture:(nonnull id<SCCameraKitTexture>)texture;
Parameters
cameraKit
the CameraKit responsible for the frame.
texture
a texture describing processed input. SCCameraKitPreviewView is able to render this, and future classes will be provided for additional functionality (eg, video recording).
-
Notifies that a new video frame is available.
Note
This method WILL NOT BE CALLED unless you have indicated you need sample buffer output (for situations like recording). This incurs performance overhead, so do not use it unless you require it.See
SCCameraKitOutputRequiringPixelBufferWarning
DO NOT stop or start CameraKit in this output method. This method doesn’t guarantee that CamearKit has finished processing the current frame, so stopping or starting in this method is undefined behavior, which can lead to other outputs getting invalid/released video buffers or deadlocking the current thread.Declaration
Objective-C
- (void)cameraKit:(nonnull id<SCCameraKitProtocol>)cameraKit didOutputVideoSampleBuffer:(nonnull CMSampleBufferRef)sampleBuffer;
Parameters
cameraKit
the CameraKit responsible for the frame.
sampleBuffer
a CMSampleBuffer describing the video output.
-
Notifies that a new audio buffer is available
Warning
DO NOT stop or start CameraKit in this output method. This method doesn’t guarantee that CamearKit has finished processing the current frame, so stopping or starting in this method is undefined behavior, which can lead to other outputs getting invalid/released audio buffers or deadlocking the current thread.Declaration
Objective-C
- (void)cameraKit:(nonnull id<SCCameraKitProtocol>)cameraKit didOutputAudioSampleBuffer:(nonnull CMSampleBufferRef)sampleBuffer;
Parameters
cameraKit
the CameraKit responsible for the audio buffer
sampleBuffer
a CMSampleBuffer describing the audio output