mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-20 11:15:02 +01:00
Store whether a participant is connected or not
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
719797b1d1
commit
c2ef651ce3
@ -2050,6 +2050,18 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
String sessionId = peerConnectionEvent.getSessionId();
|
String sessionId = peerConnectionEvent.getSessionId();
|
||||||
|
|
||||||
if (peerConnectionEvent.getPeerConnectionEventType() ==
|
if (peerConnectionEvent.getPeerConnectionEventType() ==
|
||||||
|
PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED) {
|
||||||
|
if (participantDisplayItems.get(sessionId) != null) {
|
||||||
|
participantDisplayItems.get(sessionId).setConnected(true);
|
||||||
|
participantsAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
} else if (peerConnectionEvent.getPeerConnectionEventType() ==
|
||||||
|
PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED) {
|
||||||
|
if (participantDisplayItems.get(sessionId) != null) {
|
||||||
|
participantDisplayItems.get(sessionId).setConnected(false);
|
||||||
|
participantsAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
} else if (peerConnectionEvent.getPeerConnectionEventType() ==
|
||||||
PeerConnectionEvent.PeerConnectionEventType.PEER_CLOSED) {
|
PeerConnectionEvent.PeerConnectionEventType.PEER_CLOSED) {
|
||||||
endPeerConnection(sessionId, VIDEO_STREAM_TYPE_SCREEN.equals(peerConnectionEvent.getVideoStreamType()));
|
endPeerConnection(sessionId, VIDEO_STREAM_TYPE_SCREEN.equals(peerConnectionEvent.getVideoStreamType()));
|
||||||
} else if (peerConnectionEvent.getPeerConnectionEventType() ==
|
} else if (peerConnectionEvent.getPeerConnectionEventType() ==
|
||||||
@ -2239,12 +2251,20 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
String session,
|
String session,
|
||||||
boolean videoStreamEnabled,
|
boolean videoStreamEnabled,
|
||||||
String videoStreamType) {
|
String videoStreamType) {
|
||||||
|
PeerConnectionWrapper peerConnectionWrapper = getPeerConnectionWrapperForSessionIdAndType(session,
|
||||||
|
videoStreamType);
|
||||||
|
|
||||||
|
boolean connected = false;
|
||||||
|
if (peerConnectionWrapper != null) {
|
||||||
|
PeerConnection.IceConnectionState iceConnectionState = peerConnectionWrapper.getPeerConnection().iceConnectionState();
|
||||||
|
connected = iceConnectionState == PeerConnection.IceConnectionState.CONNECTED ||
|
||||||
|
iceConnectionState == PeerConnection.IceConnectionState.COMPLETED;
|
||||||
|
}
|
||||||
|
|
||||||
String nick;
|
String nick;
|
||||||
if (hasExternalSignalingServer) {
|
if (hasExternalSignalingServer) {
|
||||||
nick = webSocketClient.getDisplayNameForSession(session);
|
nick = webSocketClient.getDisplayNameForSession(session);
|
||||||
} else {
|
} else {
|
||||||
PeerConnectionWrapper peerConnectionWrapper = getPeerConnectionWrapperForSessionIdAndType(session,
|
|
||||||
videoStreamType);
|
|
||||||
nick = peerConnectionWrapper != null ? peerConnectionWrapper.getNick() : "";
|
nick = peerConnectionWrapper != null ? peerConnectionWrapper.getNick() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2268,6 +2288,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
|
|
||||||
ParticipantDisplayItem participantDisplayItem = new ParticipantDisplayItem(userId,
|
ParticipantDisplayItem participantDisplayItem = new ParticipantDisplayItem(userId,
|
||||||
session,
|
session,
|
||||||
|
connected,
|
||||||
nick,
|
nick,
|
||||||
urlForAvatar,
|
urlForAvatar,
|
||||||
mediaStream,
|
mediaStream,
|
||||||
|
@ -6,6 +6,7 @@ import org.webrtc.MediaStream;
|
|||||||
public class ParticipantDisplayItem {
|
public class ParticipantDisplayItem {
|
||||||
private String userId;
|
private String userId;
|
||||||
private String session;
|
private String session;
|
||||||
|
private boolean connected;
|
||||||
private String nick;
|
private String nick;
|
||||||
private String urlForAvatar;
|
private String urlForAvatar;
|
||||||
private MediaStream mediaStream;
|
private MediaStream mediaStream;
|
||||||
@ -14,9 +15,10 @@ public class ParticipantDisplayItem {
|
|||||||
private EglBase rootEglBase;
|
private EglBase rootEglBase;
|
||||||
private boolean isAudioEnabled;
|
private boolean isAudioEnabled;
|
||||||
|
|
||||||
public ParticipantDisplayItem(String userId, String session, String nick, String urlForAvatar, MediaStream mediaStream, String streamType, boolean streamEnabled, EglBase rootEglBase) {
|
public ParticipantDisplayItem(String userId, String session, boolean connected, String nick, String urlForAvatar, MediaStream mediaStream, String streamType, boolean streamEnabled, EglBase rootEglBase) {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.session = session;
|
this.session = session;
|
||||||
|
this.connected = connected;
|
||||||
this.nick = nick;
|
this.nick = nick;
|
||||||
this.urlForAvatar = urlForAvatar;
|
this.urlForAvatar = urlForAvatar;
|
||||||
this.mediaStream = mediaStream;
|
this.mediaStream = mediaStream;
|
||||||
@ -41,6 +43,14 @@ public class ParticipantDisplayItem {
|
|||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isConnected() {
|
||||||
|
return connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConnected(boolean connected) {
|
||||||
|
this.connected = connected;
|
||||||
|
}
|
||||||
|
|
||||||
public String getNick() {
|
public String getNick() {
|
||||||
return nick;
|
return nick;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user