question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin does not show camera preview on iOS after updating to iOS 15.4

See original GitHub issue

Describe the bug All was working fine until I update my iPhone to iOS 15 (not sure which minor version started the problem), but now after call CameraPreview.start method the camera preview doesn’t appear. The led that indicates the device is using the camera turns on and if I call CameraPreview.capture method the picture is returned as expected but without showing the preview during all the process.

To Reproduce Steps to reproduce the behavior:

  1. Just start the camera preview.

Expected behavior Show the camera preview when start method is called.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: iPhone 11
  • OS: iOS 15.4.1
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context As I said, previously everything was working as expected. I didn’t change anything in the code regarding Camera Preview and I only noticed the problem when some users of my app reported it to me. For Android it continues to work normally and the problem only occurs on iOS.

Code snippet that calls the start method:

const cameraPreviewOptions: CameraPreviewOptions = {
  position: 'rear',
  width: this.platformWidth,
  height: this.platformHeight,
  toBack: true,
  rotateWhenOrientationChanged: false
};

await CameraPreview.start(cameraPreviewOptions);
some dependencies in my package.json: {
    "@angular/core": "~10.0.0",
    "@capacitor-community/camera-preview": "^1.0.6",
    "@capacitor/android": "^2.4.3",
    "@capacitor/core": "2.4.3",
    "@capacitor/ios": "^2.4.3",
    "@ionic/angular": "^5.0.0"
  }

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Codemax999commented, Aug 12, 2022

@sertal70 @IgorSamer I can’t remember exactly what it was, but with iOS 15 there was view that was behaving differently or needed to be targeted to force the transparency.

In Plugin.swift -> start () try this:

self.webView?.backgroundColor = UIColor.clear self.webView?.isOpaque = false self.webView?.scrollView.backgroundColor = UIColor.clear self.webView?.scrollView.isOpaque = false

And in the stop() try this:

self.webView?.backgroundColor = self.viewColor ?? UIColor.white self.webView?.isOpaque = true

1reaction
sertal70commented, Jun 9, 2022

I’ve performed a set of tests to get some additional informations of this issue, here are my results. (All test have been done on iPhone XR with iOS 15.5)

Test 1

Original camera-preview plugin demo project: issue present

Test 2

Modified camera-preview plugin demo project with version 3 of Capacitor and plugin: issue present

Test 3

Original cordova-camera-preview demo project: issue not present

Test 4

Modified Capacitor camera-preview plugin demo project to use Cordova camera-preview plugin instead of Capacitor camera-preview plugin: issue not present

Definitely it seems an issue with the plugin, both in version 2 and 3. I tried to compare the iOS code of both plugins but I’m not an expert in iOS programming so I were unable to detect any differences between the two.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Camera not working on iOS16 | Apple Developer Forums
I installed the iOS16 beta to test the new features and everything works well except the camera, which when I access it the...
Read more >
[Solved] Can't View iPhone Photos on Windows 11/10/8/7 PC
Your iPhone camera roll folder may be empty. iPhone photos do not show up on PC if it doesn't have photos or videos...
Read more >
Known issues in Lightroom - Adobe Support
Lightroom detects the plugged in Apple iPhone mobile device but the Add Photos screen shows zero images to import. (Operating system: Windows, ...
Read more >
iOS version history - Wikipedia
iOS is a mobile operating system developed by Apple Inc. It was first released as iPhone OS in June 2007. iPhone OS was...
Read more >
iOS 16: Everything you need to know about 2022's big iPhone ...
CarPlay sees a powerful update that makes it more all-encompassing, but you won't see it until late 2023. Apple's in-box apps also see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found