Hello, i am currently on a project where I need to use the front Camera of a phone. To do so, i am using the WebCamTexture and display it in a Raw Image.
Thing is the the Camera Image that I receive on my phone is a bit laggy but more important has a huge delay (like 1s a movement is registered). My phone is decent(Galaxy S8) but I don't have this issue in PlayMode.
Here is the code that i am using, i have tried with fix resolution as well, doesn't matter :
private void Init() { WebCamDevice[] devices = WebCamTexture.devices; if (devices.Length == 0) { isCamAvailable = false; return; } for (int i = 0; i < devices.Length; i++) { if (devices[i].isFrontFacing) { frontCam = new WebCamTexture(devices[i].name, Screen.height, Screen.width, -1); name = devices[i].name; } } if (frontCam == null) { isCamAvailable = false; return; } frontCam.filterMode = FilterMode.Trilinear; frontCam.Play(); background.texture = frontCam; isCamAvailable = true; }
Thank you for your help
Thing is the the Camera Image that I receive on my phone is a bit laggy but more important has a huge delay (like 1s a movement is registered). My phone is decent(Galaxy S8) but I don't have this issue in PlayMode.
Here is the code that i am using, i have tried with fix resolution as well, doesn't matter :
private void Init() { WebCamDevice[] devices = WebCamTexture.devices; if (devices.Length == 0) { isCamAvailable = false; return; } for (int i = 0; i < devices.Length; i++) { if (devices[i].isFrontFacing) { frontCam = new WebCamTexture(devices[i].name, Screen.height, Screen.width, -1); name = devices[i].name; } } if (frontCam == null) { isCamAvailable = false; return; } frontCam.filterMode = FilterMode.Trilinear; frontCam.Play(); background.texture = frontCam; isCamAvailable = true; }
Thank you for your help