Package com.kurento.kmf.media

Examples of com.kurento.kmf.media.WebRtcEndpoint


    if ("register".equalsIgnoreCase(cmdType)) {
      if (sessions == null) {
        sessions = new HashMap<String, WebRtcContentSession>();
        MediaPipeline mp = session.getMediaPipelineFactory().create();
        session.releaseOnTerminate(mp);
        WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
        session.releaseOnTerminate(webRtcEndpoint);
        session.setAttribute(WEBRTCKEY, webRtcEndpoint);
        getLogger().info("**** {}", session.getSessionId());

        sessions.put(session.getSessionId(), session);
        result = "Waiting for another user in the room";

      } else {
        WebRtcEndpoint firstWebRtcEndpoint = (WebRtcEndpoint) sessions
            .values().iterator().next().getAttribute(WEBRTCKEY);
        MediaPipeline mp = firstWebRtcEndpoint.getMediaPipeline();
        WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
        session.releaseOnTerminate(webRtcEndpoint);
        webRtcEndpoint.connect(firstWebRtcEndpoint);
        session.setAttribute(WEBRTCKEY, webRtcEndpoint);

        getLogger().info("++++ {}", session.getSessionId());

        firstWebRtcEndpoint.connect(webRtcEndpoint);
        webRtcEndpoint.connect(firstWebRtcEndpoint);

        sessions.put(session.getSessionId(), session);
        result = "Connecting users";

        for (WebRtcContentSession s : sessions.values()) {
View Full Code Here


  public void onContentRequest(WebRtcContentSession contentSession)
      throws Exception {
    MediaPipeline mp = contentSession.getMediaPipelineFactory().create();
    contentSession.releaseOnTerminate(mp);
    JackVaderFilter filter = mp.newJackVaderFilter().build();
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    webRtcEndpoint.connect(filter);
    filter.connect(webRtcEndpoint);
    contentSession.start(webRtcEndpoint);
  }
View Full Code Here

      contentSession.start(firstWebRtcEndpoint);
    } else {
      MediaPipeline mp = firstWebRtcEndpoint.getMediaPipeline();

      WebRtcEndpoint newWebRtcEndpoint = mp.newWebRtcEndpoint().build();
      contentSession.releaseOnTerminate(newWebRtcEndpoint);
      newWebRtcEndpoint.connect(firstWebRtcEndpoint);
      firstWebRtcEndpoint.connect(newWebRtcEndpoint);

      if (contentId != null && contentId.equalsIgnoreCase("record")) {
        RecorderEndpoint recorderEndPoint = mp.newRecorderEndpoint(
            "file:///tmp/peer").build();
        contentSession.setAttribute("recorder", recorderEndPoint);
        newWebRtcEndpoint.connect(recorderEndPoint);
      }

      contentSession.start(newWebRtcEndpoint);
    }
  }
View Full Code Here

        return;
      }
    }

    // Build WebRtcEndpoint
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    contentSession.releaseOnTerminate(webRtcEndpoint);

    // Check if it is a transmitter or a receiver
    Constraints videoConstraints = contentSession.getVideoConstraints();
View Full Code Here

  public void onContentRequest(WebRtcContentSession contentSession)
      throws Exception {
    MediaPipeline mp = contentSession.getMediaPipelineFactory().create();
    contentSession.releaseOnTerminate(mp);
    filter = mp.newJackVaderFilter().build();
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    webRtcEndpoint.connect(filter);
    filter.connect(webRtcEndpoint);
    contentSession.start(webRtcEndpoint);
  }
View Full Code Here

    }
    if (existName(name)) {
      session.terminate(403, "User " + name + " is already in the room. "
          + "Please select another name and try again.");
    } else {
      WebRtcEndpoint endpoint = mp.newWebRtcEndpoint().build();
      HubPort hubPort = dispatcher.newHubPort().build();
      endpoint.connect(hubPort);
      hubPort.connect(endpoint);
      DispatcherParticipant participant = new DispatcherParticipant(
          session.getSessionId(), name, endpoint, session, hubPort);
      session.start(participant.endpoint);
      session.setAttribute("participant", participant);
View Full Code Here

    MediaPipeline mp = contentSession.getMediaPipelineFactory().create();
    contentSession.releaseOnTerminate(mp);
    filter = mp.newFaceOverlayFilter().build();
    filter.setOverlayedImage(imageUrl, -0.35F, -1.2F, 1.6F, 1.6F);
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    webRtcEndpoint.connect(filter);
    filter.connect(webRtcEndpoint);
    contentSession.start(webRtcEndpoint);
  }
View Full Code Here

    if (contentId != null && contentId.equalsIgnoreCase("mp4")) {
      mediaProfileSpecType = MediaProfileSpecType.MP4;
    }
    recorderEndPoint = mp.newRecorderEndpoint(TARGET)
        .withMediaProfile(mediaProfileSpecType).build();
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();

    webRtcEndpoint.connect(webRtcEndpoint);
    webRtcEndpoint.connect(recorderEndPoint);
    contentSession.start(webRtcEndpoint);
  }
View Full Code Here

    final MediaPipeline mp = contentSession.getMediaPipelineFactory()
        .create();
    contentSession.releaseOnTerminate(mp);

    // Media Elements: WebRTC Endpoint, Filter
    final WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    final PointerDetectorFilter pointerDetectorFilter = mp
        .newPointerDetectorFilter().build();
    final FaceOverlayFilter faceOverlayFilter = mp.newFaceOverlayFilter()
        .build();
    PointerDetectorWindowMediaParam start = new PointerDetectorWindowMediaParam(
        "start", 100, 100, 280, 380);
    start.setImage("http://files.kurento.org/imgs/start.png");
    pointerDetectorFilter.addWindow(start);
    pointerDetectorFilter
        .addWindowInListener(new MediaEventListener<WindowInEvent>() {
          public void onEvent(WindowInEvent event) {
            // Set overlay image
            faceOverlayFilter.setOverlayedImage(
                "http://files.kurento.org/imgs/mario-wings.png",
                -0.35F, -1.2F, 1.6F, 1.6F);
          }
        });

    // Connections
    webRtcEndpoint.connect(pointerDetectorFilter);
    pointerDetectorFilter.connect(faceOverlayFilter);
    faceOverlayFilter.connect(webRtcEndpoint);

    // Start content session
    contentSession.start(webRtcEndpoint);
View Full Code Here

    // Media Pipeline
    MediaPipeline mp = contentSession.getMediaPipelineFactory().create();
    contentSession.releaseOnTerminate(mp);

    // Media Elements: WebRTC Endpoint
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();

    // Connections
    webRtcEndpoint.connect(webRtcEndpoint);

    // Start content session
    contentSession.start(webRtcEndpoint);
  }
View Full Code Here

TOP

Related Classes of com.kurento.kmf.media.WebRtcEndpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.