unlockCaptureOrientation method

  1. @override
Future<void> unlockCaptureOrientation(
  1. int cameraId
)

Unlocks the capture orientation.

Implementation

@override
Future<void> unlockCaptureOrientation(int cameraId) async {
  try {
    final html.ScreenOrientation? orientation = window?.screen?.orientation;
    final html.Element? documentElement = window?.document.documentElement;

    if (orientation != null && documentElement != null) {
      orientation.unlock();
    } else {
      throw PlatformException(
        code: CameraErrorCode.orientationNotSupported.toString(),
        message: 'Orientation is not supported in the current browser.',
      );
    }
  } on html.DomException catch (e) {
    throw PlatformException(code: e.name, message: e.message);
  }
}