Show camera stream while AVCaptureSession's running

后端 未结 1 1934
北荒
北荒 2021-02-02 01:47

I was able to capture video frames from the camera using AVCaptureSession according to http://developer.apple.com/iphone/library/qa/qa2010/qa1702.html. However, it seems that AV

相关标签:
1条回答
  • 2021-02-02 02:49

    AVCaptureVideoPreviewLayer is exactly what you're looking for.

    The code fragment Apple uses to demonstrate how to use it is:

    AVCaptureSession *captureSession = <#Get a capture session#>;
    AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:captureSession];
    UIView *aView = <#The view in which to present the layer#>;
    previewLayer.frame = aView.bounds; // Assume you want the preview layer to fill the view.
    [aView.layer addSublayer:previewLayer];
    
    0 讨论(0)
提交回复
热议问题