Closed kendo6666 closed 1 month ago
_listener
contains a collection of all events. You need to subdivide different events to listen.
for more information, see event types
_listener
..on<RoomDisconnectedEvent>((event) async {
})
..on<ParticipantEvent>((event) {
print('Participant event');
})
..on<RoomRecordingStatusChanged>((event) {
})
..on<RoomAttemptReconnectEvent>((event) {
})
..on<LocalTrackSubscribedEvent>((event) {
})
..on<LocalTrackPublishedEvent>((_) => _sortParticipants())
..on<LocalTrackUnpublishedEvent>((_) => _sortParticipants())
..on<TrackSubscribedEvent>((_) => _sortParticipants())
..on<TrackUnsubscribedEvent>((_) => _sortParticipants())
..on<TrackE2EEStateEvent>(_onE2EEStateEvent)
..on<ParticipantNameUpdatedEvent>((event) {
})
..on<ParticipantMetadataUpdatedEvent>((event) {
})
..on<RoomMetadataChangedEvent>((event) {
})
..on<DataReceivedEvent>((event) {
})
..on<AudioPlaybackStatusChanged>((event) async {
});
We have observed that the _onRoomDidUpdate callback is being triggered almost every second, which leads to the _sortParticipants method being called frequently. This behavior is causing performance concerns in our application.
Code Snippet:
Environment: Livekit SDK Version: 2.2.2 Device/OS: iOS
Observed Behavior: The _onRoomDidUpdate callback is being triggered almost every second. This frequent triggering leads to the _sortParticipants method being called repeatedly, causing performance issues.
Is it because I used the SDK incorrectly?
Thank you for your attention to this matter. Best regard