From c0a3820d3b5342938685ca0d98379dd927b42c05 Mon Sep 17 00:00:00 2001 From: td Date: Mon, 22 Apr 2024 18:03:39 +0530 Subject: [PATCH] fix: tryCatch editing mediaConstraints --- lib/src/mediadevices_impl.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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')) {