imaginary-cloud / CameraManager

Simple Swift class to provide all the configurations you need to create custom camera view in your app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(edit) The owner of this repo is M.I.A. (/edit) Blacked out exposure after re-opening viewcontroller

ded opened this issue · comments

Hi there,
Using your Hello world example from the README, and [your pretty straight forward documentation], I'm experiencing an issue where the exposure / capture gets very blurry, and/or darkened after opening an instance multiple times over from a typical present() (using the iOS 13 card style - you know, the kind where you can dismiss by swiping down).

Here are my settings:

class PersonalVideoViewController: UIViewController {
  @IBOutlet weak var videoView: UIView! // from storyboard
  override func viewDidLoad() {
    cameraManager.cameraDevice = .front // this is a requirement, not going to change this.
    cameraManager.cameraOutputQuality = .high // changing this didn't make a difference
    cameraManager.flashMode = .off // changing this didn't make a difference
    cameraManager.showAccessPermissionPopupAutomatically = false
    cameraManager.exposureMode = .autoExpose // changing this didn't make a difference
    let _ = self.cameraManager.addPreviewLayerToView(self.videoView, newCameraOutputMode: .videoWithMic)
  }
}

I've created a screen recording illustrating the issue as an attempt to integrate into our application.

https://www.dropbox.com/home/Development/video?preview=Video+Jul+16%2C+8+25+35+PM.mp4

Notice it's called as a self.present(myVideoController). I attempt to adjust some exposure settings during the first pass. Then dismiss... then re-open. The problem worsens. Then I attempt to increase the exposure (because it got too dark), then everything gets too blurry. I dismiss it... re-open... and then the screen start back at a very-dark underexposed image again.

To give a concession that I'm willing to sacrifice — The complete black screen as it's booting up seems pretty normal to me (this happens on Instagram too when you open their camera — so that's ok).

Any ideas why I would be experiencing this?

Here is how it's being presented from the base controller. As mentioned. Nothing crazy.

let storyboard = UIStoryboard(name: "Settings", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "PersonalVideoViewController") as! PersonalVideoViewController
self.present(vc, animated: true, completion: nil)

iPhone XS 13.5.1

Circling back. Hello.

Is this thing working?

Would you mind at least letting people know you no longer plan on maintaining the project? It might help others to move on to alternative options.

Anyone else here? Is this guy on vacation?

Submitting issues here is obviously pointless and a waste of time.

I understand how open source works. I’ve reported a bug on a library you wrote. It’s common decency to at least reply with “I’m sorry I don’t have an answer right now” instead of waiting 10 days to leave a snarky remark to one of your supporters.

Would have loved if this issue was solved.

So after not giving up on this library, I got a workaround for it. All you need do is call resumeCaptureSession() on the cameraManager in your viewWillAppear(); and stopCaptureSession() in your viewWillDisappear().

override func viewWillAppear(_ animated: Bool) {
        self.cameraManager.resumeCaptureSession()
}

and also in your viewWillDisappear

override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        cameraManager.stopCaptureSession()
}