getSupportedTorchStates method

Future<List<String>> getSupportedTorchStates()

Implementation

Future<List<String>> getSupportedTorchStates() async {
  try {
    final track = localMediaStream?.getVideoTracks();
    if (track != null) {
      final imageCapture = ImageCapture(track.first);
      final photoCapabilities = await promiseToFuture<PhotoCapabilities>(
        imageCapture.getPhotoCapabilities(),
      );

      return photoCapabilities.fillLightMode;
    }
  } catch (e) {
    // ImageCapture is not supported by some browsers:
    // https://developer.mozilla.org/en-US/docs/Web/API/ImageCapture#browser_compatibility
  }
  return [];
}