Topic locked

Vuforia fails to initialize camera

December 16, 2014 - 2:32am #1

Vuforia SDK Version: 3.0.9 -
Description with steps to reproduce:

I have a problem using Vuforia with Unity 4.5.4.

I use an iPad 2 with iOS 8.1.2 and an iPad 3 with 8.1.1 as test devices and on both (and additional test devices my customer uses) I sometimes (about 50% of the cases) I get a black screen instead of the camera background. The app does not freeze, but does not track either. I also tried the Background Texture example and was able to reproduce the error (with a white background as this example inverts camera input). I also tried some of the solutions suggested in other bugs:

I also noted that this part of the app's output seems to be related to the error:

cameraDeviceInitCamera
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView has CAEAGLLayer class
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView does not respond to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView has CAEAGLLayer class
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView does not respond to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
cameraDeviceGetVideoMode
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView has CAEAGLLayer class
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView does not respond to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView has CAEAGLLayer class
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView does not respond to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
cameraDeviceSelectVideoMode
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView has CAEAGLLayer class
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView does not respond to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView has CAEAGLLayer class
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView does not respond to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
cameraDeviceStartCamera
markerTrackerStart
imageTrackerStart
cameraDeviceGetVideoMode
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView has CAEAGLLayer class
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView does not respond to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView has CAEAGLLayer class
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) UIView does not respond to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
Dec 16 10:47:16 hueck3d[9819:1743351] DEBUG/AR(9819) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
-> applicationWillResignActive()

This was from my app, the Background Texture example outputs similar errors:

Dec 16 11:14:15 bta[9856] <Warning>: INFO/AR(9856) 2014-12-16 11:14:15: ImageTracker: Successfully created dataset
Dec 16 11:14:15 bta[9856] <Warning>: *** -[AVCaptureVideoDataOutput setVideoSettings:] - videoSettings dictionary contains one or more unsupported (ignored) keys: (
	    Height,
	    Width
	)
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
Dec 16 11:14:15 kernel[0] <Notice>: AppleH4CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 0, index: 0
Dec 16 11:14:15 backboardd[56] <Warning>: |GAXGeneral|info| Did verify event: [Substantial Transition did occur]. Outcome: [Error - Session app was nil].
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:15 bta[9856] <Warning>: DEBUG/AR(9856) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
Dec 16 11:14:16 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:16 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:16 bta[9856] <Warning>: DEBUG/AR(9856) UIView has CAEAGLLayer class
Dec 16 11:14:16 bta[9856] <Warning>: DEBUG/AR(9856) UIView does not respond to selector renderFrameQCAR
Dec 16 11:14:16 bta[9856] <Warning>: DEBUG/AR(9856) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR

Any ideas what this may be about and how to fix it?

-
Development OS (Mac OS X, Windows, Linux): Mac OS X Yosemite -
Mobile OS and Version: 8.1.2 -
Mobile Device Manufacturer and Model name: Apple iPad 2 & 3 -
Do the Vuforia Sample Applications show the same behavior?: Yes, Background Texture example does the same.

Vuforia fails to initialize camera

January 13, 2015 - 11:53pm #21

As an additional info:

is your Unity project setup also relying on the use of multiple cameras (e.g. one ARCamera and one Background Camera) like in the BTA sample ?

Vuforia fails to initialize camera

January 12, 2015 - 12:17am #20

Some updates from our testing:

We tried the 3.0.9 BTA built on 4.5.5 Unity on iPad 3 running 8.1.1.
 
We saw the white screen issue only the first time when launching the app because of the popup to allow camera access.
When we killed and restarted the app after allowing the camera access we were not able to reproduce it. 
 
This issue was not seen even for the first time when we tried with Vuforia 4.0 beta. 
 
So, you may want to upgrade to 4.0 beta and try it, and see if that resolves the issue; the SDK 4.0 beta can be found here:
 
 
 

Vuforia fails to initialize camera

January 9, 2015 - 2:56am #19

I've done most of my testing after reproducing the issue with the BTA example with the actual app I'm working on. The app is rather large (about 200MB on iOS) and takes some time to load. In this constellation I was able to reproduce the issue every time I start the app.

Vuforia fails to initialize camera

January 6, 2015 - 1:09am #18

I understand. But previously you also mentioned that you can reproduce the issue using the BTA sample app, by killing / restarting the App;   based on this, I'm trying to see if we can reproduce the same issue with the BTA and the process above (so far without success);   is there any suggestion about the timing ? e.g. should I wait a certain time before restarting the BTA sample App after killing it ?

 

Vuforia fails to initialize camera

December 29, 2014 - 2:52am #17

As I wrote before: This is clearly a timing issue. If Vuforia takes too long to access the camera stream the OS decides to shut the camera down and from that point only delivers a black screen even if the camera access is stopped and restartet using the Vuforia API.

Vuforia fails to initialize camera

December 18, 2014 - 3:03am #16

I have tried to reproduce this on iPad mini on iOS 8.1.2, with the BTA sample as we said, using the steps:

- start app

- kill app

- restart app

- repeat steps above several times

But I could not reproduce it.

The only thing I could reproduce is a black screen only when pausing and resuming the App (but NOT when "killing and restarting" the app).

The "pause/resume" issue is already discussed here (and currently under investigation):

https://developer.vuforia.com//forum/issues-and-bugs/background-texture-access-ios-8-black-screen

 

I will give another try on iPad 3, to see if it shows up more easily.

 

Vuforia fails to initialize camera

December 17, 2014 - 4:45am #15

It seems to be a timing issue. I added another scene/level to my Unity project which did nothing but loading the actual app level and having an ARCamera running in the background. This level loads very fast and the device camera gets used by the ARCamera. In the next level the device camera is also available for Vuforia. I suspect that there is some kind of timeout to shut of the camera if it isn't used, that only triggers if the scene takes to long to load.

Vuforia fails to initialize camera

December 17, 2014 - 4:08am #14

In this case we'll just have to try and reproduce it here. I will let you know.

Vuforia fails to initialize camera

December 17, 2014 - 4:00am #13

Unfortunately this didn't fix it. Is the error message in log I posted in the first post of any use?

Vuforia fails to initialize camera

December 16, 2014 - 12:00pm #12

The code seems correct, however, you are not taking any action when the "granted" boolean is FALSE; you have copy-pasted the code snippet from the posted guidelines, but here you should actually "do something" (for example, exit the App or something like showing a dialog to the user):

[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
			if (YES == granted) {
				// User granted access to the camera, continue with app launch
                         
			}
			else {
				// User denied camera access
				// warn the user that the app requires camera access
				// and ideally provide some guidance about the device Settings
                                // or simply exit the app:
                                exit(0);
			}
			// Here mark that the camera access check has been completed
			// (no matter if the 'granted' is YES or NO)
			CameraCheckDone = YES;
		}];

 

Also, in the while(!CameraCheckDone) loop, it's better to add a sleeping call, to avoid that the loop gets stuck:

NSLog(@"Waiting for camera access check to be completed ...");
while (!CameraCheckDone) { 
    [NSThread sleepForTimeInteval:0.2];
} 

NSLog (@"Can continue");  
 
Try the changes above;  not sure they will fix your issue, but worth giving a try.
 
 

Vuforia fails to initialize camera

December 16, 2014 - 9:04am #11

I was able to test it on an iPad Mini 2 with 7.0.4. It works here all the time. So it seems to have something to do with iOS 8. I attached my UnityAppController.mm, maybe I did something wrong while follwing the guidelines.

AttachmentSize
Plain text icon UnityAppController.mm_.txt11.48 KB

Vuforia fails to initialize camera

December 16, 2014 - 7:40am #10

Yes. I was able to reproduce it this way. Please note that the propability seems to vary with the device you are using. Our iPad 2 exposed this error more often than our iPad 3.

Vuforia fails to initialize camera

December 16, 2014 - 7:36am #9

OK, so, in this case, let me try to reproduce using the BTA sample;

starting / killing / restarting the app multiple times should trigger it at some point , according to your previous description ?

 

Vuforia fails to initialize camera

December 16, 2014 - 7:16am #8

I know the link you posted and I used an implementation of these guidelines.

Also Camera access is granted (the entry in the Privacy settings has the green switch). Otherwise there would be no camera at all, so this is not the case here.

Vuforia fails to initialize camera

December 16, 2014 - 7:04am #7

Is it possible that the camera has a timeout which triggers it to turn off

Not too sure; it might be, but I am not aware of such a thing;

however, when dealing with iOS 8 Camera Access, you need to make sure that the Camera access is granted by the user BEFORE Vuforia gets initialized;

since, as you say, the black screen happens a bit randomly (i.e. not all the times) and only on iOS 8, I strongly suspect that you might have not implemented the Camera Access policy correctly; the complete guide to do that is here:

https://developer.vuforia.com/forum/ios/ios-8-xcode-6-and-vuforia-30-compatibility

 

Vuforia fails to initialize camera

December 16, 2014 - 6:43am #6

Yes, I use the default camera app. This only works if you open it directly before opening my app.

Is it possible that the camera has a timeout which triggers it to turn off, before Vuforia begins to use it. I am using a fix to prevent the camera access problem in my app (https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/ios-8-compatability-vuforia#comment-2043923). I imagine this may increase startup time long enough to make this happen.

Vuforia fails to initialize camera

December 16, 2014 - 6:17am #5

if you open the iOS camera before starting the app it seems to work.

Do you open the iOS Camera using the Camera App installed by default on the iOS device ?

Is it sufficient to open the Camera once, and then every subsequent Vuforia runs will work ? 

 

 

Vuforia fails to initialize camera

December 16, 2014 - 5:17am #4

We were just testing wild constellations to pin down the error. It seems that if you open the iOS camera before starting the app it seems to work.

Vuforia fails to initialize camera

December 16, 2014 - 4:27am #3

I didn't even try to pause and resume the app, because my initial problem appeared at start. You have to try several times (I did kill the app using the App Drawer between each try). The iPad 2 seems to have the problem more often than the iPad 3.

Vuforia fails to initialize camera

December 16, 2014 - 3:43am #2

Hi, thanks for the report.

you mention that you can reproduce this with the BTA sample;

could you please specify the steps you use to reproduce it with the BTA sample ?

Is it upon pausing and resuming the App ? or just at first start ?

 

Topic locked