Java Code Examples for org.webrtc.PeerConnection.IceConnectionState

The following are top voted examples for showing how to use org.webrtc.PeerConnection.IceConnectionState. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: nc-android-webrtcpeer   File: PeerConnectionClient.java   Source Code and License 6 votes vote down vote up
@Override
public void onIceConnectionChange(final PeerConnection.IceConnectionState newState) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            Log.d(TAG, "IceConnectionState: " + newState);
            if (newState == IceConnectionState.CONNECTED) {
                events.onIceConnected();
            } else if (newState == IceConnectionState.DISCONNECTED) {
                events.onIceDisconnected();
            } else if (newState == IceConnectionState.FAILED) {
                reportError("ICE connection failed.");
            }
        }
    });
}
 
Example 2
Project: AppRTC-Android   File: PeerConnectionClient.java   Source Code and License 6 votes vote down vote up
@Override
public void onIceConnectionChange(final PeerConnection.IceConnectionState newState) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      Log.d(TAG, "IceConnectionState: " + newState);
      if (newState == IceConnectionState.CONNECTED) {
        events.onIceConnected();
      } else if (newState == IceConnectionState.DISCONNECTED) {
        events.onIceDisconnected();
      } else if (newState == IceConnectionState.FAILED) {
        reportError("ICE connection failed.");
      }
    }
  });
}
 
Example 3
Project: AndroidRTC   File: PeerConnectionClient.java   Source Code and License 6 votes vote down vote up
@Override
public void onIceConnectionChange(final PeerConnection.IceConnectionState newState) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            Log.d(TAG, "IceConnectionState: " + newState);
            if (newState == IceConnectionState.CONNECTED) {
                events.onIceConnected();
            } else if (newState == IceConnectionState.DISCONNECTED) {
                events.onIceDisconnected();
            } else if (newState == IceConnectionState.FAILED) {
                reportError("ICE connection failed.");
            }
        }
    });
}
 
Example 4
Project: voip_android   File: PeerConnectionClient.java   Source Code and License 6 votes vote down vote up
@Override
public void onIceConnectionChange(final PeerConnection.IceConnectionState newState) {
    executor.execute(new Runnable() {
        @Override
        public void run() {
            Log.d(TAG, "IceConnectionState: " + newState);
            if (newState == IceConnectionState.CONNECTED) {
                events.onIceConnected();
            } else if (newState == IceConnectionState.DISCONNECTED) {
                events.onIceDisconnected();
            } else if (newState == IceConnectionState.FAILED) {
                reportError("ICE connection failed.");
            }
        }
    });
}
 
Example 5
Project: restcomm-android-sdk   File: PeerConnectionClient.java   Source Code and License 6 votes vote down vote up
@Override
public void onIceConnectionChange(final PeerConnection.IceConnectionState newState) {
  executor.execute(new Runnable() {
    @Override
    public void run() {
      Log.d(TAG, "IceConnectionState: " + newState);
      if (newState == IceConnectionState.CONNECTED) {
        events.onIceConnected();
      } else if (newState == IceConnectionState.DISCONNECTED) {
        events.onIceDisconnected();
      } else if (newState == IceConnectionState.FAILED) {
        reportError("ICE connection failed.");
      }
    }
  });
}
 
Example 6
Project: AndroidRTC   File: PeerConnectionTest.java   Source Code and License 5 votes vote down vote up
@Override
public synchronized void onIceConnectionChange(IceConnectionState newState) {
  // TODO(bemasc): remove once delivery of ICECompleted is reliable
  // (https://code.google.com/p/webrtc/issues/detail?id=3021).
  if (newState.equals(IceConnectionState.COMPLETED)) {
    return;
  }

  if (expectedIceConnectionChanges.isEmpty()) {
    System.out.println(name + "Got an unexpected ice connection change " + newState);
    return;
  }

  assertEquals(expectedIceConnectionChanges.removeFirst(), newState);
}
 
Example 7
Project: AndroidRTC   File: PeerConnectionTest.java   Source Code and License 5 votes vote down vote up
private static void shutdownPC(PeerConnection pc, ObserverExpectations expectations) {
  if (expectations.dataChannel != null) {
    expectations.dataChannel.unregisterObserver();
    expectations.dataChannel.dispose();
  }
  expectations.expectStatsCallback();
  assertTrue(pc.getStats(expectations, null));
  assertTrue(expectations.waitForAllExpectationsToBeSatisfied(TIMEOUT_SECONDS));
  expectations.expectIceConnectionChange(IceConnectionState.CLOSED);
  expectations.expectSignalingChange(SignalingState.CLOSED);
  pc.close();
  assertTrue(expectations.waitForAllExpectationsToBeSatisfied(TIMEOUT_SECONDS));
  expectations.expectStatsCallback();
  assertTrue(pc.getStats(expectations, null));
  assertTrue(expectations.waitForAllExpectationsToBeSatisfied(TIMEOUT_SECONDS));

  System.out.println("FYI stats: ");
  int reportIndex = -1;
  for (StatsReport[] reports : expectations.takeStatsReports()) {
    System.out.println(" Report #" + (++reportIndex));
    for (int i = 0; i < reports.length; ++i) {
      System.out.println("  " + reports[i].toString());
    }
  }
  assertEquals(1, reportIndex);
  System.out.println("End stats.");

  pc.dispose();
}
 
Example 8
Project: AndroidRTC   File: PeerConnectionTest.java   Source Code and License 4 votes vote down vote up
public synchronized void expectIceConnectionChange(IceConnectionState newState) {
  expectedIceConnectionChanges.add(newState);
}
 
Example 9
Project: webrtc-workshop   File: PeerConnectionWrapper.java   Source Code and License 4 votes vote down vote up
public void onIceConnectionChange(IceConnectionState iceConnectionState) {
	connectionStateCallback.onConnectionStateChange(iceConnectionState.toString());
}
 
Example 10
Project: licodeAndroidClient   File: LicodeConnector.java   Source Code and License 4 votes vote down vote up
@Override
public void onIceConnectionChange(IceConnectionState arg0) {
}
 
Example 11
Project: webrtcpeer-android   File: NBMWebRTCPeer.java   Source Code and License 2 votes vote down vote up
/**
 * WebRTC event which is triggered when ICE status has changed
 * @param state The new ICE connection state
 * @param connection The connection for which this event takes place
 */
void onIceStatusChanged(IceConnectionState state, NBMPeerConnection connection);
 
Example 12
Project: webrtc-java   File: Observer.java   Source Code and License 2 votes vote down vote up
@Override
public synchronized void onIceConnectionChange(IceConnectionState newState) {

}