diff --git a/lib/src/mediadevices_impl.dart b/lib/src/mediadevices_impl.dart index e04a600..a7d9192 100644 --- a/lib/src/mediadevices_impl.dart +++ b/lib/src/mediadevices_impl.dart @@ -20,14 +20,13 @@ class MediaDevicesWeb extends MediaDevices { mediaConstraints['video'].remove('facingMode'); } } + mediaConstraints.putIfAbsent('video', () => false); + mediaConstraints.putIfAbsent('audio', () => false); } catch (e) { print( '[getUserMedia] failed to remove facingMode from mediaConstraints'); } - mediaConstraints.putIfAbsent('video', () => false); - mediaConstraints.putIfAbsent('audio', () => false); - final mediaDevices = web.window.navigator.mediaDevices; if (jsutil.hasProperty(mediaDevices, 'getUserMedia')) {