Topic locked

AR camera becomes black in the second run

November 11, 2014 - 10:07pm #1

Reproduce bug:

1. Open an AR sample, i.e. Image Marker sample, until AR camera has been already loaded.

2. Press device home button

3. Quickly open AR application again, the screen becomes black.

This problem only occurs on iOS not in Android.

I have tested on iPhone 4S, 5, 6, 6+, iPad 4 with Unity 4.5.4 and Vuforia 3.0.9

Anyone has the same problem? Please help.

Thank you in advance!

AR camera becomes black in the second run

February 23, 2015 - 11:11pm #8

AR camera becomes black in the second run

February 20, 2015 - 5:24am #7

Hi, 

Subject: Camera is black with Vuforia 4.0 beta with IOS Native UI (https://developer.vuforia.com/forum/vuforia-40-beta/camera-not-opened-and-screen-black-vuforia-40-beta)

If i run the vuforia 4.0 beta SDK with Unity3d 4.6.2, working excellent.

But when i integrate the same project with IOS native UI  (http://www.the-nerd.be/2014/08/06/add-unity3d-in-a-native-ios-application/), Camera is black.But the augmentation is working (have a look on attached image).

How to solve the issue ? Can anyone help on this? 

How to resolve this Black screnn issue ?

Thank you,

AttachmentSize
Image icon IMG_0818.PNG20.09 KB

AR camera becomes black in the second run

November 16, 2014 - 5:00pm #6
vamshi,
it seems that this problem is similar to the problem in the link of AlessandroB but different from the problem described in your link.
 
I am not sure if our trick can solve your problem. Please post your result.

AR camera becomes black in the second run

November 14, 2014 - 5:09am #5

Yes @huythach , Your logic DisableARCamera and EnableARCamera logic solved my issue (tested 100 more times) !!!

Thank you. 

AR camera becomes black in the second run

November 13, 2014 - 7:53am #4

we found a trick for this problem by disable and enable AR camera if user opens an AR application after press home button less than 5 seconds.

 

It sounds like the same problem discussed here:

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

This is a known issue currently under investigation.

 

AR camera becomes black in the second run

November 13, 2014 - 5:21am #3

Hi,

Am also facing the same Black screen issue.

i have created a post https://developer.vuforia.com/forum/device-support/black-screen-ios-devices-camera-mode#comment-2045304.

meanwhile, Let me check with your logic !!! i hope it would work !!!

AR camera becomes black in the second run

November 13, 2014 - 12:47am #2

After working around, we found a trick for this problem by disable and enable AR camera if user opens an AR application after press home button less than 5 seconds.

This may be not the best solution, but it solves our problem now.

Looking forward to information from Vuforia SDK development team.

 

using UnityEngine;
using System;
using System.Collections;

public class GoToBackgroundController : MonoBehaviour
{
	
	private const int MAX_WAITING_TIME = 5;
	private int pauseStartTime = 0;
	
	void OnApplicationPause (bool pauseStatus)
	{
		// Pause
        if (pauseStatus == true)
        {
			// Update variable
            pauseStartTime = GetUnixTime(DateTime.Now);
        }
        // Resume
        else
        {
            int resumeTime = GetUnixTime(DateTime.Now);

            // Wake up in less than 5 seconds, we need to restart AR camera
            if (resumeTime < pauseStartTime + MAX_WAITING_TIME)
            {
                StartCoroutine(RestartARCamera());
            }
        }
	}
	
	private IEnumerator RestartARCamera ()
	{
		yield return new WaitForEndOfFrame();
		
		// Disable AR camera
		DisableARCamera();
		
		// Wait for 1 second before enable AR camera
		yield return new WaitForSeconds(1.0f);
		
		// Enable AR camera
		EnableARCamera();
	}
	
	private static DateTime Unix_Epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0);

    private int GetUnixTime (DateTime targetTime)
    {
		targetTime = targetTime.ToUniversalTime();
        TimeSpan elspeedTime = targetTime - Unix_Epoch;

        return (int)elspeedTime.TotalSeconds;
    }
	
	private void DisableARCamera ()
	{
		CameraDevice.Instance.Deinit();
		CameraDevice.Instance.Stop();
	}
	
	private void EnableARCamera ()
	{
		CameraDevice.Instance.Init(CameraDevice.CameraDirection.CAMERA_BACK);
		CameraDevice.Instance.Start();
        CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);
	}
}

 

Topic locked