public void setFlashMode(boolean on) {
    if (mCamera == null) {
      return;
    }

    releaseCamera();

    int cameraId = mPublisher.getCameraId();

    ((CustomVideoCapturer) mPublisher.getCapturer()).setFlashOn(true);

    //		Camera camera = Camera.open(cameraId);
    //		try {
    //			camera.setPreviewDisplay(new SurfaceView(mContext).getHolder());
    //		} catch (IOException e) {
    //			// TODO Auto-generated catch block
    //			e.printStackTrace();
    //		}
    //		Parameters params = camera.getParameters();
    //		params.setFlashMode(Parameters.FLASH_MODE_TORCH);
    //		camera.setParameters(params);

    //		try {
    //			ClassLoader cl = ClassLoader.getSystemClassLoader();
    //			mCameraClass = cl.loadClass("android.hardware.Camera");
    //			mParametersClass = cl.loadClass("android.hardware.Camera$Parameters");
    //			Method method = mCameraClass.getMethod("open", Integer.TYPE);
    //			mCamera = method.invoke(mCamera, cameraId);
    //
    //			SurfaceView surface = new SurfaceView(mContext);
    //			SurfaceHolder holder = surface.getHolder();
    //			method = mCameraClass.getMethod("setPreviewDisplay", SurfaceHolder.class);
    //			method.invoke(mCamera, holder);
    ////			Camera c;
    ////			c.setPreviewDisplay(holder);
    //
    //			Method m = mCameraClass.getMethod("getParameters");
    //			Object params = m.invoke(mCamera);
    //			m = mParametersClass.getMethod("setFlashMode", String.class);
    //			m.invoke(params,
    // on?FLASH_MODE_TORCH:mOriginalFlashMode==null?FLASH_MODE_OFF:mOriginalFlashMode);
    //
    //			m = mCameraClass.getMethod("setParameters", mParametersClass);
    //			m.invoke(mCamera, params);
    //
    //			Log.i(TAG, "flash mode is set");
    //
    //			m = mCameraClass.getMethod("release");
    //			m.invoke(mCamera);
    //		} catch (Throwable t) {
    //			Log.e(TAG, "aaa", t);
    //		}

    attachCamera();
  }
  public boolean isFlashLightOn() {
    if (mPublisher == null) {
      return false;
    }

    if (true) return ((CustomVideoCapturer) mPublisher.getCapturer()).isFlashOn();

    releaseCamera();

    boolean result = false;
    int cameraId = mPublisher.getCameraId();

    try {
      ClassLoader cl = ClassLoader.getSystemClassLoader();
      mCameraClass = cl.loadClass("android.hardware.Camera");
      mParametersClass = cl.loadClass("android.hardware.Camera$Parameters");
      Method method = mCameraClass.getMethod("open", Integer.TYPE);
      mCamera = method.invoke(mCamera, cameraId);

      SurfaceView surface = new SurfaceView(mContext);
      SurfaceHolder holder = surface.getHolder();
      method = mCameraClass.getMethod("setPreviewDisplay", SurfaceHolder.class);
      method.invoke(mCamera, holder);

      Method m = mCameraClass.getMethod("getParameters");
      Object params = m.invoke(mCamera);
      m = mParametersClass.getMethod("getFlashMode");
      String flashMode = (String) m.invoke(params);

      m = mCameraClass.getMethod("release");
      m.invoke(mCamera);

      if (FLASH_MODE_TORCH.equals(flashMode)) {
        result = true;
      } else {
        mOriginalFlashMode = flashMode;
        result = false;
      }
    } catch (Throwable t) {
      Log.e(TAG, "aaa", t);
      result = false;
    }

    attachCamera();

    return result;
  }