Package com.kurento.kmf.media

Examples of com.kurento.kmf.media.WebRtcEndpoint


  public void doTest(Browser browserType, String video, Color color)
      throws InterruptedException {
    // Media Pipeline #1
    MediaPipeline mp = pipelineFactory.create();
    WebRtcEndpoint webRtcEP = mp.newWebRtcEndpoint().build();
    RecorderEndpoint recorderEP = mp.newRecorderEndpoint(
        FILE_SCHEMA + getDefaultFileForRecording()).build();
    webRtcEP.connect(webRtcEP);
    webRtcEP.connect(recorderEP);

    // Test execution #1. WewbRTC in loopback while it is recorded
    BrowserClient.Builder builder = new BrowserClient.Builder().browser(
        browserType).client(Client.WEBRTC);
    if (video != null) {
      builder = builder.video(video);
    }

    try (BrowserClient browser = builder.build()) {
      browser.subscribeEvents("playing");
      browser.connectToWebRtcEndpoint(webRtcEP,
          WebRtcChannel.AUDIO_AND_VIDEO);
      recorderEP.record();

      // Wait until event playing in the remote stream
      Assert.assertTrue("Timeout waiting playing event",
          browser.waitForEvent("playing"));

      // Guard time to play the video
      Thread.sleep(PLAYTIME * 1000);

      // Assert play time
      double currentTime = browser.getCurrentTime();
      Assert.assertTrue("Error in play time of HTTP player (expected: "
          + PLAYTIME + " sec, real: " + currentTime + " sec)",
          compare(PLAYTIME, currentTime));

      // Assert color
      if (color != null) {
        Assert.assertTrue("The color of the video should be " + color,
            browser.colorSimilarTo(color));
      }
    }

    // Stop and release media elements
    recorderEP.stop();
    webRtcEP.release();
    recorderEP.release();

    // Media Pipeline #2
    PlayerEndpoint playerEP = mp.newPlayerEndpoint(
        FILE_SCHEMA + getDefaultFileForRecording()).build();
View Full Code Here


  }

  public void doTest(Browser browserType, String videoPath, String audioUrl,
      Color color) throws InterruptedException {
    MediaPipeline mp = pipelineFactory.create();
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    webRtcEndpoint.connect(webRtcEndpoint);

    BrowserClient.Builder builder = new BrowserClient.Builder().browser(
        browserType).client(Client.WEBRTC);
    if (videoPath != null) {
      builder = builder.video(videoPath);
View Full Code Here

    // Media Pipeline
    MediaPipeline mp = pipelineFactory.create();

    PlayerEndpoint playerEP = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/30sec/red.webm").build();
    WebRtcEndpoint webRtcEP = mp.newWebRtcEndpoint().build();

    Dispatcher dispatcher = mp.newDispatcher().build();
    HubPort hubPort1 = dispatcher.newHubPort().build();
    HubPort hubPort2 = dispatcher.newHubPort().build();
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 = compsite.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

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

    // Media Elements: WebRTC Endpoint, Recorder Endpoint
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    RecorderEndpoint recorderEndpoint = mp.newRecorderEndpoint(
        "file:///tmp/recording").build();
    contentSession.setAttribute("recorder", recorderEndpoint);

    // Connections
    webRtcEndpoint.connect(webRtcEndpoint);
    webRtcEndpoint.connect(recorderEndpoint);

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

    FaceOverlayFilter filter = mp.newFaceOverlayFilter().build();
    filter.setOverlayedImage(
        "http://files.kurento.org/imgs/mario-wings.png", -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

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

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

    // Media Elements: WebRTC Endpoint, Recorder Endpoint
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    RecorderEndpoint recorderEndpoint = mp.newRecorderEndpoint(
        "file:///tmp/recording").build();
    contentSession.setAttribute("recorder", recorderEndpoint);

    // Connections
    webRtcEndpoint.connect(webRtcEndpoint);
    webRtcEndpoint.connect(recorderEndpoint);

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

  public void onContentRequest(final WebRtcContentSession session)
      throws Exception {
    MediaPipeline mp = session.getMediaPipelineFactory().create();
    session.releaseOnTerminate(mp);

    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    PlateDetectorFilter plateDetectorFilter = mp.newPlateDetectorFilter()
        .build();
    session.setAttribute("plateValue", "");
    plateDetectorFilter
        .addPlateDetectedListener(new MediaEventListener<PlateDetectedEvent>() {
          @Override
          public void onEvent(PlateDetectedEvent event) {
            getLogger().info("Plate detected {}", event);
            if (session.getAttribute("plateValue").toString()
                .equals(event.getPlate())) {
              return;
            }
            session.setAttribute("plateValue", event.getPlate());
            session.publishEvent(new ContentEvent(event.getType(),
                event.getPlate()));
          }
        });

    webRtcEndpoint.connect(plateDetectorFilter);
    plateDetectorFilter.connect(webRtcEndpoint);

    session.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);
      // endpoint.connect(endpoint);
      DispatcherParticipant participant = new DispatcherParticipant(
          session.getSessionId(), name, endpoint, session, hubPort);
      session.start(participant.endpoint);
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.