davidliu
Committed by GitHub

Receive remote participant disconnected updates while reconnecting (#224)

@@ -33,7 +33,7 @@ data class ConnectOptions( @@ -33,7 +33,7 @@ data class ConnectOptions(
33 /** 33 /**
34 * the protocol version to use with the server. 34 * the protocol version to use with the server.
35 */ 35 */
36 - val protocolVersion: ProtocolVersion = ProtocolVersion.v8 36 + val protocolVersion: ProtocolVersion = ProtocolVersion.v9
37 ) { 37 ) {
38 internal var reconnect: Boolean = false 38 internal var reconnect: Boolean = false
39 internal var participantSid: String? = null 39 internal var participantSid: String? = null
@@ -668,11 +668,12 @@ constructor( @@ -668,11 +668,12 @@ constructor(
668 } 668 }
669 669
670 val isNewParticipant = !remoteParticipants.contains(participantSid) 670 val isNewParticipant = !remoteParticipants.contains(participantSid)
671 - val participant = getOrCreateRemoteParticipant(participantSid, info)  
672 671
673 if (info.state == LivekitModels.ParticipantInfo.State.DISCONNECTED) { 672 if (info.state == LivekitModels.ParticipantInfo.State.DISCONNECTED) {
674 handleParticipantDisconnect(participantSid) 673 handleParticipantDisconnect(participantSid)
675 - } else if (isNewParticipant) { 674 + } else {
  675 + val participant = getOrCreateRemoteParticipant(participantSid, info)
  676 + if (isNewParticipant) {
676 listener?.onParticipantConnected(this, participant) 677 listener?.onParticipantConnected(this, participant)
677 eventBus.postEvent(RoomEvent.ParticipantConnected(this, participant), coroutineScope) 678 eventBus.postEvent(RoomEvent.ParticipantConnected(this, participant), coroutineScope)
678 } else { 679 } else {
@@ -680,6 +681,7 @@ constructor( @@ -680,6 +681,7 @@ constructor(
680 } 681 }
681 } 682 }
682 } 683 }
  684 + }
683 685
684 /** 686 /**
685 * @suppress 687 * @suppress
@@ -760,4 +760,5 @@ enum class ProtocolVersion(val value: Int) { @@ -760,4 +760,5 @@ enum class ProtocolVersion(val value: Int) {
760 v6(6), 760 v6(6),
761 v7(7), 761 v7(7),
762 v8(8), 762 v8(8),
  763 + v9(9),
763 } 764 }