mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-13 15:54:59 +01:00
Post event when a participant is connected and disconnected
RTCPeerConnections have several states but, for simplicity, for now the events posted reflect only if the connection is fully established or not (which includes both a broken connection or an established connection that is unstable or being updated), which is enough for a basic information about the connection state in the UI. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
53e3543839
commit
9f445efc1c
@ -120,6 +120,6 @@ public class PeerConnectionEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum PeerConnectionEventType {
|
public enum PeerConnectionEventType {
|
||||||
PEER_CONNECTED, PEER_CLOSED, SENSOR_FAR, SENSOR_NEAR, NICK_CHANGE, AUDIO_CHANGE, VIDEO_CHANGE, PUBLISHER_FAILED
|
PEER_CONNECTED, PEER_DISCONNECTED, PEER_CLOSED, SENSOR_FAR, SENSOR_NEAR, NICK_CHANGE, AUDIO_CHANGE, VIDEO_CHANGE, PUBLISHER_FAILED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,6 +344,8 @@ public class PeerConnectionWrapper {
|
|||||||
|
|
||||||
Log.d("iceConnectionChangeTo: ", iceConnectionState.name() + " over " + peerConnection.hashCode() + " " + sessionId);
|
Log.d("iceConnectionChangeTo: ", iceConnectionState.name() + " over " + peerConnection.hashCode() + " " + sessionId);
|
||||||
if (iceConnectionState.equals(PeerConnection.IceConnectionState.CONNECTED)) {
|
if (iceConnectionState.equals(PeerConnection.IceConnectionState.CONNECTED)) {
|
||||||
|
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED,
|
||||||
|
sessionId, null, null, null));
|
||||||
|
|
||||||
if (!isMCUPublisher) {
|
if (!isMCUPublisher) {
|
||||||
EventBus.getDefault().post(new MediaStreamEvent(remoteStream, sessionId, videoStreamType));
|
EventBus.getDefault().post(new MediaStreamEvent(remoteStream, sessionId, videoStreamType));
|
||||||
@ -352,11 +354,20 @@ public class PeerConnectionWrapper {
|
|||||||
if (hasInitiated) {
|
if (hasInitiated) {
|
||||||
sendInitialMediaStatus();
|
sendInitialMediaStatus();
|
||||||
}
|
}
|
||||||
|
} else if (iceConnectionState.equals(PeerConnection.IceConnectionState.COMPLETED)) {
|
||||||
|
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED,
|
||||||
|
sessionId, null, null, null));
|
||||||
} else if (iceConnectionState.equals(PeerConnection.IceConnectionState.CLOSED)) {
|
} else if (iceConnectionState.equals(PeerConnection.IceConnectionState.CLOSED)) {
|
||||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
|
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
|
||||||
.PEER_CLOSED, sessionId, null, null, videoStreamType));
|
.PEER_CLOSED, sessionId, null, null, videoStreamType));
|
||||||
|
} else if (iceConnectionState.equals(PeerConnection.IceConnectionState.DISCONNECTED) ||
|
||||||
|
iceConnectionState.equals(PeerConnection.IceConnectionState.NEW) ||
|
||||||
|
iceConnectionState.equals(PeerConnection.IceConnectionState.CHECKING)) {
|
||||||
|
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED,
|
||||||
|
sessionId, null, null, null));
|
||||||
} else if (iceConnectionState.equals(PeerConnection.IceConnectionState.FAILED)) {
|
} else if (iceConnectionState.equals(PeerConnection.IceConnectionState.FAILED)) {
|
||||||
|
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED,
|
||||||
|
sessionId, null, null, null));
|
||||||
if (isMCUPublisher) {
|
if (isMCUPublisher) {
|
||||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PUBLISHER_FAILED, sessionId, null, null, null));
|
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PUBLISHER_FAILED, sessionId, null, null, null));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user