Topic locked

Device Camera Availability Callback after Vuforia Disable

December 16, 2020 - 1:18am #1

I have an issue that has only popped up recently with newer iOS devices and iOS upgrades where trying to initialize a WebCamTexure right after disabling Vuforia is causing a conflict that stalls the app for about 10-15 seconds

In my implementation, I disable Vuforia using:

    VuforiaBehaviour.Instance.enabled = false;

Then, I immediately try to initialize a  front-facing WebCamTexture using the following code:

    WebCamDevice[] deviceCameras = WebCamTexture.devices;

     for (int i = 0; i < deviceCameras.Length; i++) {

         if (deviceCameras[i].isFrontFacing) {

             frontCameraTexture = new WebCamTexture (deviceCameras[i].name, Screen.width, Screen.width);



     frontCameraTexture.Play ();

This method is now locking up the app completely on iPhone devices for about 10-15 seconds


This code works fine on Android devices. It has also worked fine with all iPhones in the past for several years, and it worked on the iPhone SE 2020 edition up until the iOS 14 upgrade occurred. And now it doesn't work at least on iPhone 12 and iPhone SE devices that have iOS 14

From what I can tell, it seems like disabling Vuforia takes some time, and trying to access a WebCamDevice too quickly will cause some sort of simultaneous access conflict that takes about 10 seconds to sort out...I noticed that if I add a half-second delay after disabling Vuforia and before trying to access a WebCamDevice, then everything works almost instantaneously. So maybe there was no issue in the past, but now with faster devices or more efficient OS systems, the calls are too quick and we're trying to access device hardware at the same time causing a conflict (that's my best guess)

My issue is that I added a delay that worked for some devices and not for others. So, in my quest to be consistent, more efficient, and just have better code, I am looking to see if there is some callback or bool we can check to be sure the WebCamDevice is ready to be accessed after we have requested to have Vuforia disabled?...Otherwise, we're just guessing on delay times


Topic locked