Skip to content

Commit d48b52a

Browse files
authored
fix: audio devcie ids consistency (#513)
* fix: audio devcie ids consistency * update. * update.
1 parent 1fc66a8 commit d48b52a

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/src/hardware/hardware.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,21 @@ import '../support/platform.dart';
2424
import '../track/audio_management.dart';
2525

2626
class 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
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies:
3838
uuid: '>=3.0.6'
3939
synchronized: ^3.0.0+3
4040
protobuf: ^3.0.0
41-
flutter_webrtc: ^0.10.4
41+
flutter_webrtc: ^0.10.5
4242
device_info_plus: '>=8.0.0'
4343
js: ^0.6.4
4444
platform_detect: ^2.0.7

0 commit comments

Comments
 (0)