getDisplayMedia method
Captures the screen against this factory.
Implementation
Future<MediaStream> getDisplayMedia(
Map<String, dynamic> mediaConstraints) async {
_checkDisposed('getDisplayMedia');
try {
final response = await WebRTC.invokeMethod(
'getDisplayMedia',
<String, dynamic>{
'constraints': mediaConstraints,
'factoryId': factoryId,
},
);
if (response == null) {
throw Exception('getDisplayMedia returned null, something wrong');
}
final stream = MediaStreamNative(response['streamId'] as String, 'local');
stream.setMediaTracks(response['audioTracks'], response['videoTracks']);
return stream;
} on PlatformException catch (e) {
throw 'Unable to getDisplayMedia: ${e.message}';
}
}