Fix: re-publish tracks after re connect (#238)
* fix republish local tracks after reconnect. * update flutter-webrtc. * remove unused import. * add dart_webrtc. * cleanup. * fix: Fix sendSyncState timing error, when reconnecting is sending. * Adjust the re-connect logic to ensure that the publisher negotiates and reconnects correctly. * Update room.dart
This commit is contained in:
+3
-11
@@ -166,7 +166,8 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
||||
}
|
||||
|
||||
if (connectOptions.protocolVersion.index >= ProtocolVersion.v8.index &&
|
||||
engine.fastConnectOptions != null) {
|
||||
engine.fastConnectOptions != null &&
|
||||
!engine.fullReconnect) {
|
||||
var options = engine.fastConnectOptions!;
|
||||
|
||||
var audio = options.microphone;
|
||||
@@ -263,7 +264,7 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
||||
})
|
||||
..on<SignalConnectionStateUpdatedEvent>((event) {
|
||||
// during reconnection, need to send sync state upon signal connection.
|
||||
if (event.didReconnect) {
|
||||
if (event.newState == ConnectionState.reconnecting) {
|
||||
logger.fine('Sending syncState');
|
||||
_sendSyncState();
|
||||
}
|
||||
@@ -306,11 +307,6 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
||||
} else if (event.fullReconnect &&
|
||||
event.newState == ConnectionState.connected) {
|
||||
events.emit(const RoomRestartedEvent());
|
||||
// recreate signal listener.
|
||||
await _signalListener.cancelAll();
|
||||
await _signalListener.dispose();
|
||||
_signalListener = engine.signalClient.createListener();
|
||||
_setUpSignalListeners();
|
||||
await _handlePostReconnect(event.fullReconnect);
|
||||
} else if (event.newState == ConnectionState.reconnecting) {
|
||||
events.emit(const RoomReconnectingEvent());
|
||||
@@ -366,10 +362,6 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
||||
await _cleanUp();
|
||||
}
|
||||
|
||||
Future<void> reconnect() async {
|
||||
await engine.restartConnection();
|
||||
}
|
||||
|
||||
RemoteParticipant _getOrCreateRemoteParticipant(
|
||||
String sid, lk_models.ParticipantInfo? info) {
|
||||
RemoteParticipant? participant = _participants[sid];
|
||||
|
||||
Reference in New Issue
Block a user