Skip to content

Buffer Delegate #1

@ghost

Description

Hi,

Thank you for sharing this great library. I am trying to use it for a simple video app where I plan to write a CATextLayer to each frame of the video whilst it records. I have configured the example project to record video and added the delegate to expose the buffer, but I only get a white screen when launching the app and no delegate firing. Any chance you could tell me where I went wrong?

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.cameraView.delegate = self;
    [self.cameraView setupInitialState:self.view.frame
                            cameraMode:ENGAVFoundationCameraModeVideo
                     stillCameraMethod:ENGAVFoundationStillCameraMethodVideoCapture
                           pixelFormat:kCVPixelFormatType_32BGRA];
    self.cameraView.photoPreset = AVCaptureSessionPresetiFrame960x540;
    [self.cameraView start];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)cameraController:(ENGAVFoundationCameraController *)cameraController didScaledTo:(CGFloat)scale viewRect:(CGRect)rect{
    NSLog(@"%f, %@", scale, NSStringFromCGRect(rect));
}

- (void) cameraController:(ENGAVFoundationCameraController *)cameraController drawPreviewLayer:(AVCaptureVideoPreviewLayer *)layer sampleBuffer:(CMSampleBufferRef) sampleBuffer fromConnection:(AVCaptureConnection *)connection {
    NSLog(@"%@", sampleBuffer);
}

- (void)cameraController:(ENGAVFoundationCameraController *)cameraController didFinishPickingImage:(UIImage *)image metadata:(NSDictionary *)metadata{
    ALAssetsLibrary *lib = [[ALAssetsLibrary alloc] init];
    [lib writeImageToSavedPhotosAlbum:image.CGImage
                             metadata:metadata
                      completionBlock:nil];
}
- (IBAction)onCameraButtonTapped:(id)sender {
    [self.cameraView startRecordingVideo];
}
@end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions