File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,28 @@ class MediaDevicesWeb extends MediaDevices {
27
27
print (
28
28
'[getUserMedia] failed to remove facingMode from mediaConstraints' );
29
29
}
30
+ try {
31
+ if (mediaConstraints['audio' ] is Map <String , dynamic > &&
32
+ Map .from (mediaConstraints['audio' ]).containsKey ('optional' ) &&
33
+ mediaConstraints['audio' ]['optional' ]
34
+ is List <Map <String , dynamic >>) {
35
+ List <Map <String , dynamic >> optionalValues =
36
+ mediaConstraints['audio' ]['optional' ];
37
+ final audioMap = < String , dynamic > {};
38
+
39
+ optionalValues.forEach ((option) {
40
+ option.forEach ((key, value) {
41
+ audioMap[key] = value;
42
+ });
43
+ });
44
+
45
+ mediaConstraints['audio' ].remove ('optional' );
46
+ mediaConstraints['audio' ].addAll (audioMap);
47
+ }
48
+ } catch (e, s) {
49
+ print (
50
+ '[getUserMedia] failed to translate optional audio constraints, $e , $s ' );
51
+ }
30
52
31
53
final mediaDevices = web.window.navigator.mediaDevices;
32
54
You can’t perform that action at this time.
0 commit comments