startCamera method

  1. @override
Future<bool> startCamera({
  1. int width = 640,
  2. int height = 480,
})
override

Starts the camera with specified resolution.

Implementation

@override
Future<bool> startCamera({int width = 640, int height = 480}) async {
  try {
    final constraints = {
      'video': {
        'width': width,
        'height': height,
        'facingMode': 'environment'
      }
    };
    _cameraStream = await html.window.navigator.mediaDevices?.getUserMedia(constraints);
    return _cameraStream != null;
  } catch (e) {
    _sendError('camera', e.toString());
    return false;
  }
}