Flashlight/torch control during video capture


  • administrators

    Toggling the Flashlight/Torch during the operation of the camera has known issue with returning the proper enable/disable states. ThirdEye has built an .aar library as a secondary approach to checking the flash state.
    All that needed is to add the .aar lib as a dependency and then you can control the torch outside of the normal Android way.

    Usages:

    torch = new TorchNativeLib(); if(torch.isTorchEnabled()){ Log.e(TAG, "Torch is enabled"); }else{ Log.e(TAG, "Torch is disabled"); }
    

    or

    if(torch.isTorchEnabled() == false){ torch.Enable(); StatusText.setText("Torch Enabled");
    }else{ torch.Disable(); StatusText.setText("Torch Disabled");
    }
    

    A public git project has been created containing the library and and a set of example code.
    This project can be found here.