♻️ Proper local participant
This commit is contained in:
@@ -152,7 +152,6 @@ sealed class CallParticipant with _$CallParticipant {
|
||||
required String accountId,
|
||||
@Default(null) SnAccount? account,
|
||||
required DateTime joinedAt,
|
||||
@Default(false) bool isLocal,
|
||||
}) = _CallParticipant;
|
||||
|
||||
factory CallParticipant.fromJson(Map<String, dynamic> json) =>
|
||||
|
@@ -145,6 +145,7 @@ class CallNotifier extends _$CallNotifier {
|
||||
id: _webrtcManager!.roomId,
|
||||
name: userinfo.nick,
|
||||
userinfo: userinfo,
|
||||
isLocal: true,
|
||||
)..remoteStream = _webrtcManager!.localStream, // Access local stream
|
||||
);
|
||||
|
||||
@@ -178,7 +179,6 @@ class CallNotifier extends _$CallNotifier {
|
||||
accountId: p.userinfo.id,
|
||||
account: p.userinfo,
|
||||
joinedAt: DateTime.now(),
|
||||
isLocal: true,
|
||||
);
|
||||
return CallParticipantLive(
|
||||
participant: participantInfo,
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user