Java Code Examples for org.kurento.client.WebRtcEndpoint#addIceCandidate()

The following examples show how to use org.kurento.client.WebRtcEndpoint#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: Handler.java    From kurento-tutorial-java with Apache License 2.0 6 votes vote down vote up
private void handleAddIceCandidate(final WebSocketSession session,
    JsonObject jsonMessage)
{
  String sessionId = session.getId();
  UserSession user = users.get(sessionId);

  if (user != null) {
    JsonObject jsonCandidate = jsonMessage.get("candidate").getAsJsonObject();
    IceCandidate candidate =
        new IceCandidate(jsonCandidate.get("candidate").getAsString(),
        jsonCandidate.get("sdpMid").getAsString(),
        jsonCandidate.get("sdpMLineIndex").getAsInt());

    WebRtcEndpoint webRtcEp = user.getWebRtcEndpoint();
    webRtcEp.addIceCandidate(candidate);
  }
}
 
Example 2
Source File: Handler.java    From kurento-tutorial-java with Apache License 2.0 6 votes vote down vote up
private void handleAddIceCandidate(final WebSocketSession session,
    JsonObject jsonMessage)
{
  final String sessionId = session.getId();
  if (!users.containsKey(sessionId)) {
    log.warn("[Handler::handleAddIceCandidate] Skip, unknown user, id: {}",
        sessionId);
    return;
  }

  final UserSession user = users.get(sessionId);
  final JsonObject jsonCandidate =
      jsonMessage.get("candidate").getAsJsonObject();
  final IceCandidate candidate =
      new IceCandidate(jsonCandidate.get("candidate").getAsString(),
      jsonCandidate.get("sdpMid").getAsString(),
      jsonCandidate.get("sdpMLineIndex").getAsInt());

  WebRtcEndpoint webRtcEp = user.getWebRtcEndpoint();
  webRtcEp.addIceCandidate(candidate);
}
 
Example 3
Source File: KStream.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
public void addCandidate(IceCandidate candidate, String uid) {
	if (this.uid.equals(uid)) {
		outgoingMedia.addIceCandidate(candidate);
	} else {
		WebRtcEndpoint endpoint = listeners.get(uid);
		log.debug("Add candidate for {}, listener found ? {}", uid, endpoint != null);
		if (endpoint != null) {
			endpoint.addIceCandidate(candidate);
		}
	}
}
 
Example 4
Source File: FakeParticipant.java    From kurento-room with Apache License 2.0 5 votes vote down vote up
private void onIceCandidate(Notification notif) {
  IceCandidateInfo info = (IceCandidateInfo) notif;
  log.debug("Notif details {}: {}", info.getClass().getSimpleName(), info);
  String epname = info.getEndpointName();
  if (name.equals(epname)) {
    if (webRtc != null) {
      webRtc.addIceCandidate(info.getIceCandidate());
    }
  } else {
    WebRtcEndpoint peer = peerEndpoints.get(epname);
    if (peer != null) {
      peer.addIceCandidate(info.getIceCandidate());
    }
  }
}
 
Example 5
Source File: UserSession.java    From kurento-tutorial-java with Apache License 2.0 5 votes vote down vote up
public void addCandidate(IceCandidate candidate, String name) {
  if (this.name.compareTo(name) == 0) {
    outgoingMedia.addIceCandidate(candidate);
  } else {
    WebRtcEndpoint webRtc = incomingMedia.get(name);
    if (webRtc != null) {
      webRtc.addIceCandidate(candidate);
    }
  }
}
 
Example 6
Source File: Pipeline.java    From kurento-tutorial-java with Apache License 2.0 4 votes vote down vote up
public void addCandidate(IceCandidate candidate, String session) {
  WebRtcEndpoint endpoint = this.webRtcEndpoints.get(session);
  if (endpoint != null) {
    endpoint.addIceCandidate(candidate);
  }
}