startLocalCamera method

Future<void> startLocalCamera()

Implementation

Future<void> startLocalCamera() async {
  final Map<String, dynamic> mediaConstraints = {
    'audio': true,
    'video': {
      'mandatory': {
        'minWidth': '320',
        'minHeight': '240',
        'minFrameRate': '30',
      },
      'facingMode': 'user',
      'optional': [],
    }
  };
  mediaStream = await navigator.mediaDevices.getUserMedia(mediaConstraints);
  mediaStream!.getAudioTracks().forEach((track) {
    audioTrack = track;
  });
  mediaStream!.getVideoTracks().forEach((track) {
    videoTrack = track;
  });

  renderer.srcObject = mediaStream;
}