I am trying to stop the camera instance completely of Vuforia/Unity when user presses on a button, and then restarting it once more when pressing on another button.
In an app I need to show the user the Vuforia/unity player with some AR functionality. When the user presses on a button the camera should switch, because of reasons this may not be done in Vuforia/unity itself, but rather it should start the Camera2 front Camera.
On every other devices it works by just starting the cameraView, but Samsung has done something to their core which does not enable 2 different camera instances to work at the same time.
The issue with the Samsung phones can be found here (https://us.community.samsung.com/t5/Galaxy-Note-Phones/Dual-Camera-Mode/td-p/471366) and here (https://us.community.samsung.com/t5/Galaxy-S9/Dual-Camera-mode-missing-on-the-S9/td-p/307101/page/3)
So to fix this I need to completely stop the Vuforia/unity camera, start the front camera, and after that reverse the steps. The first steps are working, but the restarting of the Vuforia/unity camera does not work and I think I'm missing something.
When trying to stop the Vuforia/unity camera I used
fun stopCamera(){
CameraDevice.getInstance().stop()
CameraDevice.getInstance().deinit()
}
And to restart
fun startCamera(){
CameraDevice.getInstance().init()
CameraDevice.getInstance().start()
}
I expected the Camera to shut down, what it does, but when trying to restart the Camera it just shows me the last frame the Camera saw before stopping.
It seemed impossible to restart the camera from within android itself. We ended up using 2 different scenes in unity and switching between them. This way we could force the camera to shut down and restart.