Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Webcamtexture with Android flashlight/torch

Discussion in 'Android' started by Alter-nater, May 5, 2022.

  1. Alter-nater

    Alter-nater

    Joined:
    Oct 1, 2021
    Posts:
    2
    For one of the projects I'm working on we need the user to be able to turn on the Android torch/flashlight while simultaneously using the camera and WebCamTexure for rendering in Unity. I'm wondering if there's any way possible to do this. I've tried multiple different avenues to try and achieve this, such as creating different plugins for each of the android camera libraries (base Camera, Camera2, and CameraX) and haven't been able to accomplish it. The main error callback that I'm getting when I try to turn the torch on is ERROR_CAMERA_IN_USE (The camera is already being used by another app), so I'm assuming Android's camera services will not allow two applications to use the same camera concurrently.

    This functionality is pretty important to our app, so I'm hoping there's some possible way to achieve this or some workaround I can implement. Does anyone have any recommendations on how to do it, or if it's even at all possible to do?
     
    wibu_991 likes this.
  2. Alter-nater

    Alter-nater

    Joined:
    Oct 1, 2021
    Posts:
    2
    Anyone? Is there really no way to use both of them simultaneously?
     
  3. mshem

    mshem

    Joined:
    Nov 30, 2016
    Posts:
    4
    bump, same issue here. webcamtexture is using the camera so android cant touch the torch...
     
  4. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,858
    CameraX has option to enable torch is it? Can't recall but I remember reading it somewhere.
     
  5. Ambrosib

    Ambrosib

    Joined:
    Sep 27, 2022
    Posts:
    1
    bump, same issue here
     
    Last edited: Sep 27, 2022
  6. wibu_991

    wibu_991

    Joined:
    Mar 1, 2021
    Posts:
    1
    bump, is there a solution to stream camera data from native to unity?
     
  7. nikosX

    nikosX

    Joined:
    Jun 6, 2019
    Posts:
    1
    well it works on iOS. But not in Android. Anyone found a solution?