mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Rather than just providing a coarse "connected" or "not connected" value now the views receive the raw ICE connection state. Combined with other properties this will make possible to show a finer grained status (like done in the WebUI), although for now just "connected" or "not connected" is still shown as before. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
149 lines
4.0 KiB
Java
149 lines
4.0 KiB
Java
package com.nextcloud.talk.adapters;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import com.nextcloud.talk.utils.ApiUtils;
|
|
|
|
import org.webrtc.EglBase;
|
|
import org.webrtc.MediaStream;
|
|
import org.webrtc.PeerConnection;
|
|
|
|
public class ParticipantDisplayItem {
|
|
private String baseUrl;
|
|
private String userId;
|
|
private String session;
|
|
private PeerConnection.IceConnectionState iceConnectionState;
|
|
private String nick;
|
|
private final String defaultGuestNick;
|
|
private String urlForAvatar;
|
|
private MediaStream mediaStream;
|
|
private String streamType;
|
|
private boolean streamEnabled;
|
|
private EglBase rootEglBase;
|
|
private boolean isAudioEnabled;
|
|
|
|
public ParticipantDisplayItem(String baseUrl, String userId, String session, PeerConnection.IceConnectionState iceConnectionState, String nick, String defaultGuestNick, MediaStream mediaStream, String streamType, boolean streamEnabled, EglBase rootEglBase) {
|
|
this.baseUrl = baseUrl;
|
|
this.userId = userId;
|
|
this.session = session;
|
|
this.iceConnectionState = iceConnectionState;
|
|
this.nick = nick;
|
|
this.defaultGuestNick = defaultGuestNick;
|
|
this.mediaStream = mediaStream;
|
|
this.streamType = streamType;
|
|
this.streamEnabled = streamEnabled;
|
|
this.rootEglBase = rootEglBase;
|
|
|
|
this.updateUrlForAvatar();
|
|
}
|
|
|
|
public String getUserId() {
|
|
return userId;
|
|
}
|
|
|
|
public void setUserId(String userId) {
|
|
this.userId = userId;
|
|
|
|
this.updateUrlForAvatar();
|
|
}
|
|
|
|
public String getSession() {
|
|
return session;
|
|
}
|
|
|
|
public void setSession(String session) {
|
|
this.session = session;
|
|
}
|
|
|
|
public boolean isConnected() {
|
|
return iceConnectionState == PeerConnection.IceConnectionState.CONNECTED ||
|
|
iceConnectionState == PeerConnection.IceConnectionState.COMPLETED;
|
|
}
|
|
|
|
public void setIceConnectionState(PeerConnection.IceConnectionState iceConnectionState) {
|
|
this.iceConnectionState = iceConnectionState;
|
|
}
|
|
|
|
public String getNick() {
|
|
if (TextUtils.isEmpty(userId) && TextUtils.isEmpty(nick)) {
|
|
return defaultGuestNick;
|
|
}
|
|
|
|
return nick;
|
|
}
|
|
|
|
public void setNick(String nick) {
|
|
this.nick = nick;
|
|
|
|
this.updateUrlForAvatar();
|
|
}
|
|
|
|
public String getUrlForAvatar() {
|
|
return urlForAvatar;
|
|
}
|
|
|
|
private void updateUrlForAvatar() {
|
|
if (!TextUtils.isEmpty(userId)) {
|
|
urlForAvatar = ApiUtils.getUrlForAvatar(baseUrl, userId, true);
|
|
} else {
|
|
urlForAvatar = ApiUtils.getUrlForGuestAvatar(baseUrl, getNick(), true);
|
|
}
|
|
}
|
|
|
|
public MediaStream getMediaStream() {
|
|
return mediaStream;
|
|
}
|
|
|
|
public void setMediaStream(MediaStream mediaStream) {
|
|
this.mediaStream = mediaStream;
|
|
}
|
|
|
|
public String getStreamType() {
|
|
return streamType;
|
|
}
|
|
|
|
public void setStreamType(String streamType) {
|
|
this.streamType = streamType;
|
|
}
|
|
|
|
public boolean isStreamEnabled() {
|
|
return streamEnabled;
|
|
}
|
|
|
|
public void setStreamEnabled(boolean streamEnabled) {
|
|
this.streamEnabled = streamEnabled;
|
|
}
|
|
|
|
public EglBase getRootEglBase() {
|
|
return rootEglBase;
|
|
}
|
|
|
|
public void setRootEglBase(EglBase rootEglBase) {
|
|
this.rootEglBase = rootEglBase;
|
|
}
|
|
|
|
public boolean isAudioEnabled() {
|
|
return isAudioEnabled;
|
|
}
|
|
|
|
public void setAudioEnabled(boolean audioEnabled) {
|
|
isAudioEnabled = audioEnabled;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "ParticipantSession{" +
|
|
"userId='" + userId + '\'' +
|
|
", session='" + session + '\'' +
|
|
", nick='" + nick + '\'' +
|
|
", urlForAvatar='" + urlForAvatar + '\'' +
|
|
", mediaStream=" + mediaStream +
|
|
", streamType='" + streamType + '\'' +
|
|
", streamEnabled=" + streamEnabled +
|
|
", rootEglBase=" + rootEglBase +
|
|
'}';
|
|
}
|
|
}
|
|
|
|
|