fix facingMode for mobile web. (#303)
This commit is contained in:
@@ -206,10 +206,13 @@ extension LocalVideoTrackExt on LocalVideoTrack {
|
||||
logger.warning('Not a camera track');
|
||||
return;
|
||||
}
|
||||
|
||||
await restartTrack(
|
||||
options.copyWith(cameraPosition: position),
|
||||
);
|
||||
final newOptions = CameraCaptureOptions(
|
||||
cameraPosition: position,
|
||||
deviceId: null,
|
||||
maxFrameRate: options.maxFrameRate,
|
||||
params: options.params);
|
||||
await restartTrack(newOptions);
|
||||
currentOptions = newOptions;
|
||||
}
|
||||
|
||||
Future<void> switchCamera(String deviceId, {bool fastSwitch = false}) async {
|
||||
|
||||
@@ -44,8 +44,9 @@ class CameraCaptureOptions extends VideoCaptureOptions {
|
||||
Map<String, dynamic> toMediaConstraintsMap() {
|
||||
var constraints = <String, dynamic>{
|
||||
...super.toMediaConstraintsMap(),
|
||||
if (deviceId == null)
|
||||
'facingMode':
|
||||
cameraPosition == CameraPosition.front ? 'user' : 'environment',
|
||||
cameraPosition == CameraPosition.front ? 'user' : 'environment'
|
||||
};
|
||||
if (deviceId != null) {
|
||||
if (kIsWeb) {
|
||||
|
||||
+2
-2
@@ -24,11 +24,11 @@ dependencies:
|
||||
uuid: ^3.0.6
|
||||
synchronized: ^3.0.0+3
|
||||
protobuf: ^2.1.0
|
||||
flutter_webrtc: 0.9.33
|
||||
flutter_webrtc: 0.9.34
|
||||
flutter_window_close: ^0.2.2
|
||||
device_info_plus: ^9.0.0
|
||||
webrtc_interface: 1.0.13
|
||||
dart_webrtc: 1.0.16
|
||||
dart_webrtc: 1.0.17
|
||||
js: ^0.6.4
|
||||
platform_detect: ^2.0.7
|
||||
js_bindings: ^0.1.2+1
|
||||
|
||||
Reference in New Issue
Block a user