♻️ Proper local participant

This commit is contained in:
2025-10-19 19:06:14 +08:00
parent f4b28c3fa2
commit a2576abee0
3 changed files with 5 additions and 12 deletions

View File

@@ -14,11 +14,13 @@ class WebRTCParticipant {
bool isAudioEnabled = true;
bool isVideoEnabled = false;
bool isConnected = false;
bool isLocal = false;
WebRTCParticipant({
required this.id,
required this.name,
required this.userinfo,
this.isLocal = false,
});
}
@@ -271,11 +273,7 @@ class WebRTCManager {
}
}
// Update audio enabled state for all participants (they share the same local stream)
for (final participant in _participants.values) {
participant.isAudioEnabled = enabled;
_participantController.add(participant);
}
_participants.values.where((e) => e.isLocal).firstOrNull?.isAudioEnabled = true;
}
Future<void> toggleCamera(bool enabled) async {
@@ -285,11 +283,7 @@ class WebRTCManager {
});
}
// Update video enabled state for all participants (they share the same local stream)
for (final participant in _participants.values) {
participant.isVideoEnabled = enabled;
_participantController.add(participant);
}
_participants.values.where((e) => e.isLocal).firstOrNull?.isVideoEnabled = true;
}
List<WebRTCParticipant> get participants => _participants.values.toList();