Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera not filling screen #19

Open
bstillitano opened this issue May 17, 2019 · 6 comments
Open

Camera not filling screen #19

bstillitano opened this issue May 17, 2019 · 6 comments
Milestone

Comments

@bstillitano
Copy link

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

@austinkettner austinkettner added this to the 1.2.1 milestone Jun 4, 2019
@chezhe
Copy link

chezhe commented Sep 28, 2019

What's .snp?

@chezhe
Copy link

chezhe commented Sep 30, 2019

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

@bstillitano
Copy link
Author

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

@croossin
Copy link

Any updates on this?

@bstillitano
Copy link
Author

Any updates on this?

They’ve abandoned this library.

@kenny-numerade
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants