|
@@ -78,8 +78,10 @@ class HardwareDetectionController extends GetxController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- void refreshDevices() {
|
|
|
-
|
|
|
+ Future<void> refreshAllDevices() async {
|
|
|
+ await refreshCameraList();
|
|
|
+ await refreshMicrophoneList();
|
|
|
+ await refreshSpeakerList();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -139,6 +141,14 @@ class HardwareDetectionController extends GetxController {
|
|
|
_stopPlaySound();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ Future<void> startDetectingAll() async {
|
|
|
+ await refreshAllDevices();
|
|
|
+ if (state.cameraList.isNotEmpty) startDetectingCamera();
|
|
|
+ if (state.microphoneList.isNotEmpty) startDetectingMicrophone();
|
|
|
+ if (state.speakerList.isNotEmpty) startDetectingSpeaker();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
void selectCameraById(String deviceId) {
|
|
|
if (state.currentCamera != null && deviceId == state.currentCamera!.id)
|
|
@@ -151,16 +161,14 @@ class HardwareDetectionController extends GetxController {
|
|
|
}
|
|
|
});
|
|
|
if (state.currentCamera == null) return;
|
|
|
-
|
|
|
-
|
|
|
if (state.detectingCamera) {
|
|
|
_stopCamera();
|
|
|
_openSelectedCamera();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- void selectMicrophoneById(String deviceId) {
|
|
|
+
|
|
|
+ Future<void> selectMicrophoneById(String deviceId) async {
|
|
|
state.microphoneList.forEach((element) {
|
|
|
if (element.id == deviceId) {
|
|
|
state.currentMicrophone = element;
|
|
@@ -169,6 +177,13 @@ class HardwareDetectionController extends GetxController {
|
|
|
}
|
|
|
});
|
|
|
if (state.currentMicrophone == null) return;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -197,7 +212,6 @@ class HardwareDetectionController extends GetxController {
|
|
|
}
|
|
|
}
|
|
|
state.deviceList.addAll(state.speakerList);
|
|
|
- print("当前总设备数量: ${state.deviceList.length}");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -214,7 +228,6 @@ class HardwareDetectionController extends GetxController {
|
|
|
}
|
|
|
}
|
|
|
state.deviceList.addAll(state.cameraList);
|
|
|
- print("当前总设备数量: ${state.deviceList.length}");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -231,7 +244,6 @@ class HardwareDetectionController extends GetxController {
|
|
|
}
|
|
|
}
|
|
|
state.deviceList.addAll(state.microphoneList);
|
|
|
- print("当前总设备数量: ${state.deviceList.length}");
|
|
|
}
|
|
|
|
|
|
|