Java Code Examples for org.webrtc.PeerConnection#PeerConnectionState

The following examples show how to use org.webrtc.PeerConnection#PeerConnectionState . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JingleRtpConnection.java    From Pix-Art-Messenger with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onConnectionChange(final PeerConnection.PeerConnectionState newState) {
    Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": PeerConnectionState changed to " + newState);
    if (newState == PeerConnection.PeerConnectionState.CONNECTED && this.rtpConnectionStarted == 0) {
        this.rtpConnectionStarted = SystemClock.elapsedRealtime();
    }
    if (newState == PeerConnection.PeerConnectionState.CLOSED && this.rtpConnectionEnded == 0) {
        this.rtpConnectionEnded = SystemClock.elapsedRealtime();
    }
    //TODO 'DISCONNECTED' might be an opportunity to renew the offer and send a transport-replace
    //TODO exact syntax is yet to be determined but transport-replace sounds like the most reasonable
    //as there is no content-replace
    if (Arrays.asList(PeerConnection.PeerConnectionState.FAILED, PeerConnection.PeerConnectionState.DISCONNECTED).contains(newState)) {
        if (isTerminated()) {
            Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": not sending session-terminate after connectivity error because session is already in state " + this.state);
            return;
        }
        new Thread(this::closeWebRTCSessionAfterFailedConnection).start();
    } else {
        updateEndUserState();
    }
}
 
Example 2
Source File: JingleRtpConnection.java    From Conversations with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onConnectionChange(final PeerConnection.PeerConnectionState newState) {
    Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": PeerConnectionState changed to " + newState);
    if (newState == PeerConnection.PeerConnectionState.CONNECTED && this.rtpConnectionStarted == 0) {
        this.rtpConnectionStarted = SystemClock.elapsedRealtime();
    }
    if (newState == PeerConnection.PeerConnectionState.CLOSED && this.rtpConnectionEnded == 0) {
        this.rtpConnectionEnded = SystemClock.elapsedRealtime();
    }
    //TODO 'DISCONNECTED' might be an opportunity to renew the offer and send a transport-replace
    //TODO exact syntax is yet to be determined but transport-replace sounds like the most reasonable
    //as there is no content-replace
    if (Arrays.asList(PeerConnection.PeerConnectionState.FAILED, PeerConnection.PeerConnectionState.DISCONNECTED).contains(newState)) {
        if (isTerminated()) {
            Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": not sending session-terminate after connectivity error because session is already in state " + this.state);
            return;
        }
        new Thread(this::closeWebRTCSessionAfterFailedConnection).start();
    } else {
        updateEndUserState();
    }
}
 
Example 3
Source File: WebRTCWrapper.java    From Pix-Art-Messenger with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onConnectionChange(PeerConnection.PeerConnectionState newState) {
    eventCallback.onConnectionChange(newState);
}
 
Example 4
Source File: WebRTCWrapper.java    From Pix-Art-Messenger with GNU General Public License v3.0 4 votes vote down vote up
public PeerConnection.PeerConnectionState getState() {
    return requirePeerConnection().connectionState();
}
 
Example 5
Source File: WebRTCWrapper.java    From Conversations with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onConnectionChange(PeerConnection.PeerConnectionState newState) {
    eventCallback.onConnectionChange(newState);
}
 
Example 6
Source File: WebRTCWrapper.java    From Conversations with GNU General Public License v3.0 4 votes vote down vote up
public PeerConnection.PeerConnectionState getState() {
    return requirePeerConnection().connectionState();
}
 
Example 7
Source File: WebRTCWrapper.java    From Pix-Art-Messenger with GNU General Public License v3.0 votes vote down vote up
void onConnectionChange(PeerConnection.PeerConnectionState newState); 
Example 8
Source File: WebRTCWrapper.java    From Conversations with GNU General Public License v3.0 votes vote down vote up
void onConnectionChange(PeerConnection.PeerConnectionState newState);