Log in or register to post comments

Change camera direction freezes application on iPad

January 11, 2018 - 6:26am #1

I am about a week into a multi platform Vuforia project and I have encountered a pretty odd issue. I have a simple method for reversing the camera direction at runtime to switch between FRONT and BACK camera with the click of a button. This works without error on my Samsung Galaxy S8 but for some reason this completely freezes the app on my iPad. 



This is the code I am using. It works perfectly on Android but it acts really bizarre on IOS. Anyone else having this issue?

public void ReverseCam()
{
        //Stop the camera
        CameraDevice.Instance.Stop();
 
       CameraDevice.Instance.Deinit();

        //Check the current camera direction

        if ((CameraDevice.Instance.GetCameraDirection() == CameraDevice.CameraDirection.CAMERA_FRONT)||
            (CameraDevice.Instance.GetCameraDirection() == CameraDevice.CameraDirection.CAMERA_DEFAULT))
        {
            //Reverse camera direction
            CameraDevice.Instance.Init(CameraDevice.CameraDirection.CAMERA_BACK);
        }
        else if(CameraDevice.Instance.GetCameraDirection() == CameraDevice.CameraDirection.CAMERA_BACK)
        {
            //Reverse camera direction
            CameraDevice.Instance.Init(CameraDevice.CameraDirection.CAMERA_FRONT);
        }
        //Start the camera again
        CameraDevice.Instance.Start();
    }

Change camera direction freezes application on iPad

January 12, 2018 - 11:33am #2

Hello vobling,

Which version of Unity are you using? Which iPad and iOS version is this occurring on?

The core samples have an example of restarting the camera with a new direction in the CameraSettings.cs file. It is doing the same thing your function is doing, but is also stopping and starting the tracker. Can you refer to the RestartCamera function in this file and see if that resolves this problem?

Thanks,

Vuforia Support

Log in or register to post comments