Fix: move waitFor<EngineConnectedEvent> after creating remote participants (#58)
* wait after creating participant * fix * wait after creating remote participants * remove unnecessary line * revert additional checks (unlikely to be required) * clean up logs * revert comment
This commit is contained in:
@@ -6,7 +6,6 @@ import '../events.dart';
|
|||||||
import '../exceptions.dart';
|
import '../exceptions.dart';
|
||||||
import '../extensions.dart';
|
import '../extensions.dart';
|
||||||
import '../logger.dart';
|
import '../logger.dart';
|
||||||
import '../managers/event.dart';
|
|
||||||
import '../proto/livekit_models.pb.dart' as lk_models;
|
import '../proto/livekit_models.pb.dart' as lk_models;
|
||||||
import '../publication/remote_track_publication.dart';
|
import '../publication/remote_track_publication.dart';
|
||||||
import '../room.dart';
|
import '../room.dart';
|
||||||
|
|||||||
+14
-14
@@ -112,6 +112,17 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
|||||||
logger.fine(
|
logger.fine(
|
||||||
'Connected to LiveKit server, version: ${joinResponse.serverVersion}');
|
'Connected to LiveKit server, version: ${joinResponse.serverVersion}');
|
||||||
|
|
||||||
|
localParticipant = LocalParticipant(
|
||||||
|
room: this,
|
||||||
|
info: joinResponse.participant,
|
||||||
|
);
|
||||||
|
|
||||||
|
for (final info in joinResponse.otherParticipants) {
|
||||||
|
logger.fine('Creating RemoteParticipant: ${info.sid}(${info.identity}) '
|
||||||
|
'tracks:${info.tracks.map((e) => e.sid)}');
|
||||||
|
_getOrCreateRemoteParticipant(info.sid, info);
|
||||||
|
}
|
||||||
|
|
||||||
logger.fine('Waiting to engine connect...');
|
logger.fine('Waiting to engine connect...');
|
||||||
|
|
||||||
// wait until engine is connected
|
// wait until engine is connected
|
||||||
@@ -120,18 +131,7 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
|||||||
onTimeout: () => throw ConnectException(),
|
onTimeout: () => throw ConnectException(),
|
||||||
);
|
);
|
||||||
|
|
||||||
localParticipant = LocalParticipant(
|
logger.fine('Room Connect completed');
|
||||||
room: this,
|
|
||||||
info: joinResponse.participant,
|
|
||||||
);
|
|
||||||
|
|
||||||
logger.fine('DEBUG_01 Did connect');
|
|
||||||
|
|
||||||
for (final info in joinResponse.otherParticipants) {
|
|
||||||
logger.fine(
|
|
||||||
'DEBUG_01 Existing Participant: ${info.sid}(${info.identity}) tracks:${info.tracks.map((e) => e.sid)}');
|
|
||||||
_getOrCreateRemoteParticipant(info.sid, info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setUpListeners() => _engineListener
|
void _setUpListeners() => _engineListener
|
||||||
@@ -168,7 +168,7 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
..on<EngineTrackAddedEvent>((event) async {
|
..on<EngineTrackAddedEvent>((event) async {
|
||||||
logger.fine('DEBUG_01 EngineTrackAddedEvent id:${event.track.id}');
|
logger.fine('EngineTrackAddedEvent trackSid:${event.track.id}');
|
||||||
|
|
||||||
final idParts = event.stream.id.split('|');
|
final idParts = event.stream.id.split('|');
|
||||||
final participantSid = idParts[0];
|
final participantSid = idParts[0];
|
||||||
@@ -216,7 +216,7 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
logger.warning('DEBUG_01 RemoteParticipant.info is null... sid:$sid');
|
logger.warning('RemoteParticipant.info is null trackSid: $sid');
|
||||||
participant = RemoteParticipant(
|
participant = RemoteParticipant(
|
||||||
room: this,
|
room: this,
|
||||||
sid: sid,
|
sid: sid,
|
||||||
|
|||||||
Reference in New Issue
Block a user