Hello everyone, I had a problem to start the webcam of my Android smartphone with the torch. If I run before the code of the webcam you can be seen, but the flash does not light! but if I leave before the flash he works, but the webcam can not see! how do I fix?
This is the code in C#
// ############## FLASH ON #############################
AndroidJavaObject javaCamera;
AndroidJavaClass cameraClass = new AndroidJavaClass("android.hardware.Camera");
int camID = 0;
javaCamera = cameraClass.CallStatic<AndroidJavaObject>("open", camID);
AndroidJavaObject cameraParameters = javaCamera.Call<AndroidJavaObject>("getParameters");
cameraParameters.Call("setFlashMode", "torch");
javaCamera.Call("setParameters", cameraParameters);
// ############## FLASH ON #############################
// ############## WEBCAM PLAY #############################
WebCamTexture webcamTexture = new WebCamTexture();
Renderer renderer = GetComponent<Renderer>();
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
// ############## WEBCAM PLAY #############################
I included these codes in the function start ();
The script must be applied on a 3D Panel