getMedia method

Future<void> getMedia()

Implementation

Future<void> getMedia() async {
  Map<String, dynamic> mediaConstraints = {
    'audio': true,
    'video': {'facingMode': 'user'}
  };
  if (kIsWeb) {
    navigator.mediaDevices
        .getUserMedia(mediaConstraints)
        .then((stream) => {
              print("thisis is local stream ${stream.id}"),

              onLocalStream?.call(stream),
              // _localStream = stream
            })
        .catchError((onError) {
      print("this is error on local stream $onError");
    });
  } else {
    if (Platform.isAndroid) {
      // startForegroundService();
    }
    navigator.mediaDevices.getUserMedia(mediaConstraints).then((stream) => {
          print("thisis is local stream ${stream.id}"),

          onLocalStream?.call(stream),
          // _localStream = stream
        });
  }
}