File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -12,16 +12,20 @@ class MediaDevicesWeb extends MediaDevices {
1212 Future <MediaStream > getUserMedia (
1313 Map <String , dynamic > mediaConstraints) async {
1414 try {
15- if (! isMobile) {
16- if (mediaConstraints['video' ] is Map &&
17- mediaConstraints['video' ]['facingMode' ] != null ) {
18- mediaConstraints['video' ].remove ('facingMode' );
15+ try {
16+ if (! isMobile) {
17+ if (mediaConstraints['video' ] is Map &&
18+ mediaConstraints['video' ]['facingMode' ] != null ) {
19+ mediaConstraints['video' ].remove ('facingMode' );
20+ }
1921 }
22+ mediaConstraints.putIfAbsent ('video' , () => false );
23+ mediaConstraints.putIfAbsent ('audio' , () => false );
24+ } catch (e) {
25+ print (
26+ '[getUserMedia] failed to remove facingMode from mediaConstraints' );
2027 }
2128
22- mediaConstraints.putIfAbsent ('video' , () => false );
23- mediaConstraints.putIfAbsent ('audio' , () => false );
24-
2529 final mediaDevices = html.window.navigator.mediaDevices;
2630 if (mediaDevices == null ) throw Exception ('MediaDevices is null' );
2731
You can’t perform that action at this time.
0 commit comments