@@ -24,19 +24,21 @@ import '../support/platform.dart';
2424import '../track/audio_management.dart' ;
2525
2626class MediaDevice {
27- const MediaDevice (this .deviceId, this .label, this .kind);
27+ const MediaDevice (this .deviceId, this .label, this .kind, this .groupId );
2828
2929 final String deviceId;
3030 final String label;
3131 final String kind;
32+ final String ? groupId;
3233
3334 @override
3435 bool operator == (covariant MediaDevice other) {
3536 if (identical (this , other)) return true ;
3637
3738 return other.deviceId == deviceId &&
3839 other.kind == kind &&
39- other.label == label;
40+ other.label == label &&
41+ other.groupId == groupId;
4042 }
4143
4244 @override
@@ -46,7 +48,7 @@ class MediaDevice {
4648
4749 @override
4850 String toString () {
49- return 'MediaDevice{deviceId: $deviceId , label: $label , kind: $kind }' ;
51+ return 'MediaDevice{deviceId: $deviceId , label: $label , kind: $kind , groupId: $ groupId }' ;
5052 }
5153}
5254
@@ -81,8 +83,9 @@ class Hardware {
8183
8284 Future <List <MediaDevice >> enumerateDevices ({String ? type}) async {
8385 var infos = await rtc.navigator.mediaDevices.enumerateDevices ();
84- var devices =
85- infos.map ((e) => MediaDevice (e.deviceId, e.label, e.kind! )).toList ();
86+ var devices = infos
87+ .map ((e) => MediaDevice (e.deviceId, e.label, e.kind! , e.groupId))
88+ .toList ();
8689 if (type != null && type.isNotEmpty) {
8790 devices = devices.where ((d) => d.kind == type).toList ();
8891 }
0 commit comments