Webcam Texture and Flashlite (Android)

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

Hello Fedybix93,
It seems that it’s not possible to access both camera and Flash at the same time ! after days of tests and discussion with plugin makers, you can start a camera, or start using Flashlight, but no possible ways to use both with WebCamTexture …
i’m trying to use alternate ways, but it seems difficult…
Don’t hésitate to post there good tips …

Hi Fedybix93. Try the NatCam API. It supports torch control and many more features. And running the torch while the camera is running is on the roadmap.

This is the answer: link text