mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-23 21:50:31 +01:00
Post MediaStreamEvents for each connection state
Rather than simplifying the states to "CONNECTED" and "DISCONNECTED" now the raw state is posted, and the handler then decides how to treat them (which, for now, is exactly as before). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
337f3d4b5e
commit
fcbfc1926d
@ -2119,10 +2119,16 @@ public class CallActivity extends CallBaseActivity {
|
||||
String sessionId = peerConnectionEvent.getSessionId();
|
||||
|
||||
if (peerConnectionEvent.getPeerConnectionEventType() ==
|
||||
PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED) {
|
||||
PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED ||
|
||||
peerConnectionEvent.getPeerConnectionEventType() ==
|
||||
PeerConnectionEvent.PeerConnectionEventType.PEER_COMPLETED) {
|
||||
handlePeerConnected(sessionId, peerConnectionEvent.getVideoStreamType());
|
||||
} else if (peerConnectionEvent.getPeerConnectionEventType() ==
|
||||
PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED) {
|
||||
PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED ||
|
||||
peerConnectionEvent.getPeerConnectionEventType() ==
|
||||
PeerConnectionEvent.PeerConnectionEventType.PEER_NEW ||
|
||||
peerConnectionEvent.getPeerConnectionEventType() ==
|
||||
PeerConnectionEvent.PeerConnectionEventType.PEER_CHECKING) {
|
||||
handlePeerDisconnected(sessionId, peerConnectionEvent.getVideoStreamType());
|
||||
} else if (peerConnectionEvent.getPeerConnectionEventType() ==
|
||||
PeerConnectionEvent.PeerConnectionEventType.PEER_CLOSED) {
|
||||
@ -2147,6 +2153,8 @@ public class CallActivity extends CallBaseActivity {
|
||||
setCallState(CallStatus.PUBLISHER_FAILED);
|
||||
webSocketClient.clearResumeId();
|
||||
hangup(false);
|
||||
} else {
|
||||
handlePeerDisconnected(sessionId, peerConnectionEvent.getVideoStreamType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +120,6 @@ public class PeerConnectionEvent {
|
||||
}
|
||||
|
||||
public enum PeerConnectionEventType {
|
||||
PEER_CONNECTED, PEER_DISCONNECTED, PEER_FAILED, PEER_CLOSED, SENSOR_FAR, SENSOR_NEAR
|
||||
PEER_NEW, PEER_CHECKING, PEER_CONNECTED, PEER_COMPLETED, PEER_DISCONNECTED, PEER_FAILED, PEER_CLOSED, SENSOR_FAR, SENSOR_NEAR
|
||||
}
|
||||
}
|
||||
|
@ -419,19 +419,21 @@ public class PeerConnectionWrapper {
|
||||
sendInitialMediaStatus();
|
||||
}
|
||||
} else if (iceConnectionState == PeerConnection.IceConnectionState.COMPLETED) {
|
||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED,
|
||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_COMPLETED,
|
||||
sessionId, null, null, videoStreamType));
|
||||
} else if (iceConnectionState == PeerConnection.IceConnectionState.CLOSED) {
|
||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
|
||||
.PEER_CLOSED, sessionId, null, null, videoStreamType));
|
||||
} else if (iceConnectionState == PeerConnection.IceConnectionState.DISCONNECTED ||
|
||||
iceConnectionState == PeerConnection.IceConnectionState.NEW ||
|
||||
iceConnectionState == PeerConnection.IceConnectionState.CHECKING) {
|
||||
} else if (iceConnectionState == PeerConnection.IceConnectionState.DISCONNECTED) {
|
||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED,
|
||||
sessionId, null, null, videoStreamType));
|
||||
} else if (iceConnectionState == PeerConnection.IceConnectionState.NEW) {
|
||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_NEW,
|
||||
sessionId, null, null, videoStreamType));
|
||||
} else if (iceConnectionState == PeerConnection.IceConnectionState.CHECKING) {
|
||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_CHECKING,
|
||||
sessionId, null, null, videoStreamType));
|
||||
} else if (iceConnectionState == PeerConnection.IceConnectionState.FAILED) {
|
||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED,
|
||||
sessionId, null, null, videoStreamType));
|
||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_FAILED,
|
||||
sessionId, null, null, videoStreamType));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user