Search Unity

Vuforia Front camera deprecation

Discussion in 'AR/VR (XR) Discussion' started by samilapf, Apr 17, 2019.

  1. samilapf

    samilapf

    Joined:
    Nov 10, 2018
    Posts:
    5
    Actually I'm working on a unity/vuforia educational project for cultural heritage.
    I was using front facing for interactive selfie filters from the project where visitors could take pictures and save on their devices.
    After updating unity I did not realized I've upgraded vuforia as well where front facing camera was deprecated. Even downgrading back to the version it was working it is not working anymore. When I switch to front camera the unity app freezes and stop.
    Thanks for help!

    Failed to set frame format
    UnityEngine.Debug:LogError(Object)
    Vuforia.CameraDevice:SetFrameFormat(PIXEL_FORMAT, Boolean)
    Vuforia.CameraDevice:ForceFrameFormat(PIXEL_FORMAT, Boolean)
    Vuforia.CameraDevice:Start()
    CameraController:RestartCamera(CameraDirection) (at Assets/Resources/CameraController.cs:37)
    CameraController:CameraChange() (at Assets/Resources/CameraController.cs:16)
    UnityEngine.EventSystems.EventSystem:Update()
     
  2. samilapf

    samilapf

    Joined:
    Nov 10, 2018
    Posts:
    5
    This is the c# I'm using to switch to front camera....

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Vuforia;


    public class CameraController : MonoBehaviour

    {
    private bool lightOn = false;
    private bool frontCamera = false;

    public void CameraChange()
    {
    if (!frontCamera)
    {
    RestartCamera(CameraDevice.CameraDirection.CAMERA_FRONT);
    frontCamera = true;
    Debug.Log("Using Front Camera");
    }
    else if (frontCamera)
    {
    RestartCamera(CameraDevice.CameraDirection.CAMERA_BACK);
    frontCamera = false;
    Debug.Log("Using Back Camera");
    }
    else
    {
    Debug.Log("No camera status available.");
    }
    }

    private void RestartCamera(CameraDevice.CameraDirection newDir)
    {
    CameraDevice.Instance.Stop();
    CameraDevice.Instance.Deinit();
    CameraDevice.Instance.Init(newDir);
    CameraDevice.Instance.Start();

    // These are to fight the bug the will otherwise flip the selfie cam upside down on iOS
    // Periodically check to see if still needed
    VuforiaUnity.OnPause();
    VuforiaUnity.OnResume();
    }
    }



    Any clues please?
     
  3. gaurav110016

    gaurav110016

    Joined:
    Aug 1, 2018
    Posts:
    2
    RestartCamera(CameraDevice.CameraDirection.CAMERA_FRONT);
    this line not working for update version vuforia 8.3.9 .
    main error for CameraDirection var not valid .
    plz solution
     
  4. nykwil

    nykwil

    Joined:
    Feb 28, 2015
    Posts:
    49
    It's a fully removed feature now, sucks for us too. Certain versions of unity still work with older Vuforia versions. I'm here because after upgrading, then subsequently downgrading to 2018.3.5 the camera is now upsidedown...
     
  5. CtFelix

    CtFelix

    Joined:
    Feb 24, 2020
    Posts:
    4
    Good day to all!
    I’m working on a project where I need to use the front camera and can’t find any information how to switch to it and is there front camera support in the current version? Maybe someone knows how to switch to the front camera for vuforia?

    Unity 2018.4.18.f1
    Vuforia 8.6.10
     
  6. nykwil

    nykwil

    Joined:
    Feb 28, 2015
    Posts:
    49
    It's deprecated. Like early in the 8.2 or something.