🐛 Bug fixes of webrtc

This commit is contained in:
2025-10-19 18:22:03 +08:00
parent e96b1fd9d4
commit 0910be88ef
3 changed files with 136 additions and 22 deletions

View File

@@ -55,7 +55,7 @@ class WebRTCManager {
try {
_localStream = await navigator.mediaDevices.getUserMedia({
'audio': true,
'video': false,
'video': true,
});
talker.info('[WebRTC] Local stream initialized');
} catch (e) {
@@ -263,6 +263,12 @@ class WebRTCManager {
track.enabled = enabled;
}
}
// 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);
}
}
Future<void> toggleCamera(bool enabled) async {
@@ -271,6 +277,12 @@ class WebRTCManager {
track.enabled = enabled;
});
}
// 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);
}
}
List<WebRTCParticipant> get participants => _participants.values.toList();