camerakit-ios icon indicating copy to clipboard operation
camerakit-ios copied to clipboard

Camera not filling screen

Open bstillitano opened this issue 5 years ago • 6 comments

Is this a bug report?

Yes.

Have you read the Contributing Guidelines?

Yes.

Environment

CameraKit Version: 1.2.0

iOS Device: iPhone X

iOS Version: 12.1.3

Steps to Reproduce

  1. Setup a basic preview view which fills the ViewController it is contained in
  2. Launch the app
  3. On devices with a notch (or taller devices in general) there will be white borders above and below the actual preview view.

Expected Behavior

Based on popular apps and most other libraries, the expectation from myself (which may not be correct) is that the preview would fill its parent view instead of fit. At a mininmum I'd expect the ability to actually set this behaviour by choice.

Actual Behavior

There is no ability to specify fill/fit mode. This is the code and the outcome.

import UIKit
import CameraKit_iOS
import SnapKit

class CameraViewController: UIViewController {
    //UI Elements
    var previewView: CKFPreviewView = CKFPreviewView()
    var cameraSession: CKFPhotoSession = CKFPhotoSession()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        //Setup Preview
        previewView.session = cameraSession
        self.view.addSubview(previewView)
        
        //Update Preview Constraints
        previewView.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
    }
    
}

File

bstillitano avatar May 17 '19 05:05 bstillitano

What's .snp?

chezhe avatar Sep 28 '19 02:09 chezhe

I use it with SwiftUI, it's size not as the frame I set.

chezhe avatar Sep 30 '19 01:09 chezhe

What's .snp?

SnapKit. Apologies for using a third party library in an issue. Have verified that even using CGRect as the frame the issue persists.

https://github.com/SnapKit/SnapKit

bstillitano avatar Oct 02 '19 00:10 bstillitano

Any updates on this?

croossin avatar Mar 12 '20 00:03 croossin

Any updates on this?

They’ve abandoned this library.

bstillitano avatar Mar 12 '20 00:03 bstillitano

I had the same issue of the camera view not filling the entire screen, but I solved it by setting the CKFPreviewView.video.previewLayer.videoGravity = .resizeAspectFill in viewDidLayoutSubviews

Hope that helps anyone reading this!

kenny-numerade avatar Jul 14 '20 01:07 kenny-numerade