//#!announcer.rb // // SCManagedCaptuerListener // Snapchat // // Created by Liu Liu on 4/23/15. // Copyright (c) 2015 Liu Liu. All rights reserved. // #import "SCCapturer.h" #import "SCManagedCaptureDevice.h" #import "SCManagedRecordedVideo.h" #import "SCVideoCaptureSessionInfo.h" #import #import #import @class SCManagedCapturer; @class SCManagedCapturerState; @class LSAGLView; @class SCManagedCapturerSampleMetadata; @protocol SCManagedCapturerListener @optional // All these calbacks are invoked on main queue // Start / stop / reset - (void)managedCapturer:(id)managedCapturer didStartRunning:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didStopRunning:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didResetFromRuntimeError:(SCManagedCapturerState *)state; // Change state methods - (void)managedCapturer:(id)managedCapturer didChangeState:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangeNightModeActive:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangePortraitModeActive:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangeFlashActive:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangeLensesActive:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangeARSessionActive:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangeFlashSupportedAndTorchSupported:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangeZoomFactor:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangeLowLightCondition:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangeAdjustingExposure:(SCManagedCapturerState *)state; - (void)managedCapturer:(id)managedCapturer didChangeCaptureDevicePosition:(SCManagedCapturerState *)state; // The video preview layer is not maintained as a state, therefore, its change is not related to the state of // the camera at all, listener show only manage the setup of the videoPreviewLayer. // Since the AVCaptureVideoPreviewLayer can only attach to one AVCaptureSession per app, it is recommended you // have a view and controller which manages the video preview layer, and for upper layer, only manage that view // or view controller, which maintains the pointer consistency. The video preview layer is required to recreate // every now and then because otherwise we will have cases that the old video preview layer may contain // residual images. - (void)managedCapturer:(id)managedCapturer didChangeVideoPreviewLayer:(AVCaptureVideoPreviewLayer *)videoPreviewLayer; - (void)managedCapturer:(id)managedCapturer didChangeVideoPreviewGLView:(LSAGLView *)videoPreviewGLView; // Video recording-related methods - (void)managedCapturer:(id)managedCapturer didBeginVideoRecording:(SCManagedCapturerState *)state session:(SCVideoCaptureSessionInfo)session; - (void)managedCapturer:(id)managedCapturer didBeginAudioRecording:(SCManagedCapturerState *)state session:(SCVideoCaptureSessionInfo)session; - (void)managedCapturer:(id)managedCapturer willFinishRecording:(SCManagedCapturerState *)state session:(SCVideoCaptureSessionInfo)session recordedVideoFuture:(SCFuture> *)recordedVideoFuture videoSize:(CGSize)videoSize placeholderImage:(UIImage *)placeholderImage; - (void)managedCapturer:(id)managedCapturer didFinishRecording:(SCManagedCapturerState *)state session:(SCVideoCaptureSessionInfo)session recordedVideo:(SCManagedRecordedVideo *)recordedVideo; - (void)managedCapturer:(id)managedCapturer didFailRecording:(SCManagedCapturerState *)state session:(SCVideoCaptureSessionInfo)session error:(NSError *)error; - (void)managedCapturer:(id)managedCapturer didCancelRecording:(SCManagedCapturerState *)state session:(SCVideoCaptureSessionInfo)session; - (void)managedCapturer:(id)managedCapturer didGetError:(NSError *)error forType:(SCManagedVideoCapturerInfoType)type session:(SCVideoCaptureSessionInfo)session; - (void)managedCapturerDidCallLenseResume:(id)managedCapturer session:(SCVideoCaptureSessionInfo)session; - (void)managedCapturer:(id)managedCapturer didAppendVideoSampleBuffer:(CMSampleBufferRef)sampleBuffer sampleMetadata:(SCManagedCapturerSampleMetadata *)sampleMetadata; // Photo methods - (void)managedCapturer:(id)managedCapturer willCapturePhoto:(SCManagedCapturerState *)state sampleMetadata:(SCManagedCapturerSampleMetadata *)sampleMetadata; - (void)managedCapturer:(id)managedCapturer didCapturePhoto:(SCManagedCapturerState *)state; - (BOOL)managedCapturer:(id)managedCapturer isUnderDeviceMotion:(SCManagedCapturerState *)state; - (BOOL)managedCapturer:(id)managedCapturer shouldProcessFileInput:(SCManagedCapturerState *)state; // Face detection - (void)managedCapturer:(id)managedCapturer didDetectFaceBounds:(NSDictionary *)faceBoundsByFaceID; - (void)managedCapturer:(id)managedCapturer didChangeExposurePoint:(CGPoint)exposurePoint; - (void)managedCapturer:(id)managedCapturer didChangeFocusPoint:(CGPoint)focusPoint; @end