Hello,
I would like to being able to stop the camera preview on android. Don't ask me why, it's just that at some moment I don't want to display it for a game. I know how to not show the camera preview, but the Vuforia SDK keep processing it in background and the device is getting very hot and consumes a lot of battery despite not showing the video.
So instead of jsut not showing the video background, I tried to really stop the camera this way :
CameraDevice.getInstance().stop(); CameraDevice.getInstance().deinit();
On my device (Sony Xperia Z5) it works fine, but on a S8, it makes a crash :
java.lang.IllegalStateException: Session has been closed; further changes are illegal. at android.hardware.camera2.impl.CameraCaptureSessionImpl.checkNotClosed(CameraCaptureSessionImpl.java:665) at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture(CameraCaptureSessionImpl.java:172) at com.vuforia.ar.pl.Camera2_Preview$AutofocusRunner.onCaptureCompleted(Camera2_Preview.java:605) at java.lang.reflect.Method.invoke(Native Method) at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39) at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.os.HandlerThread.run(HandlerThread.java:65)
Any help on doing this ?
Hello jptsetung,
Hello jptsetung,
Which version of Vuforia are you using? Are you on Native or Unity - if Unity which version of Unity? Are you able to test this on any other devices?
Thanks,
Vuforia Support
The issue I have may be the
The issue I have may be the same as that.
environment:
・Unity 2017.4.2f2
・Galaxy S8(Android 8.0.0)