Skip to content

Commit 2cf2d78

Browse files
committed
Add callback function to track when camera starts recording
1 parent 80fbdd8 commit 2cf2d78

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

LLSimpleCamera/LLSimpleCamera.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ typedef enum : NSUInteger {
4848
*/
4949
@property (nonatomic, copy) void (^onError)(LLSimpleCamera *camera, NSError *error);
5050

51+
/**
52+
* Triggered when camera starts recording
53+
*/
54+
@property (nonatomic, copy) void (^onStartRecording)(LLSimpleCamera* camera);
55+
5156
/**
5257
* Camera quality, set a constants prefixed with AVCaptureSessionPreset.
5358
* Make sure to call before calling -(void)initialize method, otherwise it would be late.

LLSimpleCamera/LLSimpleCamera.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ - (void)stopRecording:(void (^)(LLSimpleCamera *camera, NSURL *outputFileUrl, NS
404404
- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didStartRecordingToOutputFileAtURL:(NSURL *)fileURL fromConnections:(NSArray *)connections
405405
{
406406
self.recording = YES;
407+
if(self.onStartRecording) self.onStartRecording(self);
407408
}
408409

409410
- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error

0 commit comments

Comments
 (0)