openCamera method
Implementation
Future<rtc.MediaStream> openCamera(
{MediaDevice? device, bool? facingMode}) async {
var constraints = <String, dynamic>{
if (facingMode != null) 'facingMode': facingMode ? 'user' : 'environment',
};
if (device != null) {
if (lkPlatformIs(PlatformType.web)) {
constraints['deviceId'] = device.deviceId;
} else {
constraints['optional'] = [
{'sourceId': device.deviceId}
];
}
}
selectedVideoInput = device;
return rtc.navigator.mediaDevices.getUserMedia(<String, dynamic>{
'audio': false,
'video': device != null ? constraints : true,
});
}