Search in sources :

Example 1 with WebRtcEndpoint

use of org.kurento.client.WebRtcEndpoint in project openmeetings by apache.

the class KUser method cancelVideoFrom.

public void cancelVideoFrom(final String senderName) {
    log.debug("PARTICIPANT {}: canceling video reception from {}", this.uid, senderName);
    final WebRtcEndpoint incoming = incomingMedia.remove(senderName);
    log.debug("PARTICIPANT {}: removing endpoint for {}", this.uid, senderName);
    incoming.release(new Continuation<Void>() {

        @Override
        public void onSuccess(Void result) throws Exception {
            log.trace("PARTICIPANT {}: Released successfully incoming EP for {}", KUser.this.uid, senderName);
        }

        @Override
        public void onError(Throwable cause) throws Exception {
            log.warn("PARTICIPANT {}: Could not release incoming EP for {}", KUser.this.uid, senderName);
        }
    });
}
Also used : WebRtcEndpoint(org.kurento.client.WebRtcEndpoint)

Example 2 with WebRtcEndpoint

use of org.kurento.client.WebRtcEndpoint in project openmeetings by apache.

the class KUser method getEndpointForUser.

private WebRtcEndpoint getEndpointForUser(final KurentoHandler h, final KUser sender) {
    if (sender.getUid().equals(uid)) {
        log.debug("PARTICIPANT {}: configuring loopback", this.uid);
        return outgoingMedia;
    }
    log.debug("PARTICIPANT {}: receiving video from {}", this.uid, sender.getUid());
    WebRtcEndpoint incoming = incomingMedia.get(sender.getUid());
    if (incoming == null) {
        log.debug("PARTICIPANT {}: creating new endpoint for {}", this.uid, sender.getUid());
        incoming = new WebRtcEndpoint.Builder(pipeline).build();
        incoming.addIceCandidateFoundListener(new EventListener<IceCandidateFoundEvent>() {

            @Override
            public void onEvent(IceCandidateFoundEvent event) {
                JSONObject response = newKurentoMsg();
                response.put("id", "iceCandidate");
                response.put("uid", sender.getUid());
                response.put("candidate", convert(JsonUtils.toJsonObject(event.getCandidate())));
                h.sendClient(uid, response);
            }
        });
        incomingMedia.put(sender.getUid(), incoming);
    }
    log.debug("PARTICIPANT {}: obtained endpoint for {}", this.uid, sender.getUid());
    sender.getOutgoingWebRtcPeer().connect(incoming);
    return incoming;
}
Also used : WebRtcEndpoint(org.kurento.client.WebRtcEndpoint) JSONObject(com.github.openjson.JSONObject) IceCandidateFoundEvent(org.kurento.client.IceCandidateFoundEvent)

Example 3 with WebRtcEndpoint

use of org.kurento.client.WebRtcEndpoint in project openmeetings by apache.

the class KUser method release.

@Override
public void release() {
    log.debug("PARTICIPANT {}: Releasing resources", this.uid);
    for (final String remoteParticipantName : incomingMedia.keySet()) {
        log.trace("PARTICIPANT {}: Released incoming EP for {}", this.uid, remoteParticipantName);
        final WebRtcEndpoint ep = this.incomingMedia.get(remoteParticipantName);
        ep.release(new Continuation<Void>() {

            @Override
            public void onSuccess(Void result) throws Exception {
                log.trace("PARTICIPANT {}: Released successfully incoming EP for {}", KUser.this.uid, remoteParticipantName);
            }

            @Override
            public void onError(Throwable cause) throws Exception {
                log.warn("PARTICIPANT {}: Could not release incoming EP for {}", KUser.this.uid, remoteParticipantName);
            }
        });
    }
    outgoingMedia.release(new Continuation<Void>() {

        @Override
        public void onSuccess(Void result) throws Exception {
            log.trace("PARTICIPANT {}: Released outgoing EP", KUser.this.uid);
        }

        @Override
        public void onError(Throwable cause) throws Exception {
            log.warn("USER {}: Could not release outgoing EP", KUser.this.uid);
        }
    });
}
Also used : WebRtcEndpoint(org.kurento.client.WebRtcEndpoint)

Aggregations

WebRtcEndpoint (org.kurento.client.WebRtcEndpoint)3 JSONObject (com.github.openjson.JSONObject)1 IceCandidateFoundEvent (org.kurento.client.IceCandidateFoundEvent)1