Java Code Examples for org.webrtc.PeerConnection#addIceCandidate()

The following examples show how to use org.webrtc.PeerConnection#addIceCandidate() . 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: MainActivity.java    From webrtc-android-tutorial with Apache License 2.0 5 votes vote down vote up
@Override
public void onIceCandidateReceived(JSONObject data) {
    String socketId = data.optString("from");
    PeerConnection peerConnection = getOrCreatePeerConnection(socketId);
    peerConnection.addIceCandidate(new IceCandidate(
            data.optString("id"),
            data.optInt("label"),
            data.optString("candidate")
    ));
}
 
Example 2
Source File: PnPeerConnectionClient.java    From AndroidRTC with MIT License 5 votes vote down vote up
public void execute(String peerId, JSONObject payload) throws JSONException {
    Log.d("AICAction","AddIceCandidateAction");
    PeerConnection pc = peers.get(peerId).pc;
    if (pc.getRemoteDescription() != null) {
        IceCandidate candidate = new IceCandidate(
                payload.getString("sdpMid"),
                payload.getInt("sdpMLineIndex"),
                payload.getString("candidate")
        );
        pc.addIceCandidate(candidate);
    }
}
 
Example 3
Source File: PnPeerConnectionClient.java    From android-webrtc-api with MIT License 5 votes vote down vote up
public void execute(String peerId, JSONObject payload) throws JSONException {
    Log.d("AICAction","AddIceCandidateAction");
    PeerConnection pc = peers.get(peerId).pc;
    if (pc.getRemoteDescription() != null) {
        IceCandidate candidate = new IceCandidate(
                payload.getString("sdpMid"),
                payload.getInt("sdpMLineIndex"),
                payload.getString("candidate")
        );
        pc.addIceCandidate(candidate);
    }
}