Package com.kurento.kmf.media

Examples of com.kurento.kmf.media.WebRtcEndpoint


            } catch (URISyntaxException e) {
              e.printStackTrace();
            }
          }
        });
    WebRtcEndpoint webRtcEndpoint = mediaPipeline.newWebRtcEndpoint()
        .build();
    webRtcEndpoint.connect(rateLimiter);
    faceOverlayFilter.connect(webRtcEndpoint);
    contentSession.start(webRtcEndpoint);
  }
View Full Code Here


      public void onEvent(WindowOutEvent event) {
        getLogger().info("WindowInEvent OUT");
      }
    });

    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();

    webRtcEndpoint.connect(filter);
    filter.connect(webRtcEndpoint);
    session.start(webRtcEndpoint);
  }
View Full Code Here

  @Test
  public void testWebRtc2HttpSwitch() throws Exception {
    // Media Pipeline
    MediaPipeline mp = pipelineFactory.create();
    WebRtcEndpoint webRtcEndpoint1 = mp.newWebRtcEndpoint().build();
    WebRtcEndpoint webRtcEndpoint2 = mp.newWebRtcEndpoint().build();
    HttpGetEndpoint httpGetEndpoint = mp.newHttpGetEndpoint().build();

    webRtcEndpoint1.connect(webRtcEndpoint1);
    webRtcEndpoint2.connect(webRtcEndpoint2);

    BrowserClient.Builder builderWebrtc = new BrowserClient.Builder()
        .browser(Browser.CHROME).client(Client.WEBRTC);
    BrowserClient.Builder builderPlayer = new BrowserClient.Builder()
        .browser(Browser.CHROME).client(Client.PLAYER);
    try (BrowserClient browser1 = builderWebrtc.build();
        BrowserClient browser2 = builderWebrtc.build();
        BrowserClient browser3 = builderPlayer.build()) {

      // WebRTC
      browser1.subscribeEvents("playing");
      browser1.connectToWebRtcEndpoint(webRtcEndpoint1,
          WebRtcChannel.AUDIO_AND_VIDEO);
      browser2.subscribeEvents("playing");
      browser2.connectToWebRtcEndpoint(webRtcEndpoint2,
          WebRtcChannel.AUDIO_AND_VIDEO);

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

      // Round #1: Connecting WebRTC #1 to HttpEnpoint
      webRtcEndpoint1.connect(httpGetEndpoint);
      browser3.setURL(httpGetEndpoint.getUrl());
      browser3.subscribeEvents("playing");
      browser3.start();
      Assert.assertTrue("Timeout waiting playing event",
          browser3.waitForEvent("playing"));
      Assert.assertTrue(
          "The color of the video should be green (RGB #008700)",
          browser3.colorSimilarTo(new Color(0, 135, 0)));

      // Guard time to see stream from WebRTC #1
      Thread.sleep(5000);

      // Round #2: Connecting WebRTC #2 to HttpEnpoint
      webRtcEndpoint2.connect(httpGetEndpoint);

      // Guard time to see stream from WebRTC #2
      Thread.sleep(5000);
      Assert.assertTrue(
          "The color of the video should be green (RGB #008700)",
View Full Code Here

  @Test
  public void testWebRtc2Http() throws Exception {
    // Media Pipeline
    final MediaPipeline mp = pipelineFactory.create();
    final WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    webRtcEndpoint.connect(webRtcEndpoint);

    // Test execution
    try (BrowserClient browser = new BrowserClient.Builder()
        .browser(Browser.CHROME).client(Client.WEBRTC).build()) {
      browser.subscribeEvents("playing");
      browser.connectToWebRtcEndpoint(webRtcEndpoint,
          WebRtcChannel.AUDIO_AND_VIDEO);

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

      // HTTP Players
      ExecutorService exec = Executors.newFixedThreadPool(NPLAYERS);
      List<Future<?>> results = new ArrayList<>();
      for (int i = 0; i < NPLAYERS; i++) {
        results.add(exec.submit(new Runnable() {
          @Override
          public void run() {
            HttpGetEndpoint httpEP = mp.newHttpGetEndpoint()
                .build();
            webRtcEndpoint.connect(httpEP);
            try {
              createPlayer(httpEP.getUrl());
            } catch (InterruptedException e) {
              Assert.fail("Exception creating http players: "
                  + e.getClass().getName());
View Full Code Here

  @Test
  public void testWebRtcSwitch() throws InterruptedException {
    // Media pipeline
    MediaPipeline mp = pipelineFactory.create();
    WebRtcEndpoint webRtcEndpoint1 = mp.newWebRtcEndpoint().build();
    WebRtcEndpoint webRtcEndpoint2 = mp.newWebRtcEndpoint().build();
    WebRtcEndpoint webRtcEndpoint3 = mp.newWebRtcEndpoint().build();
    webRtcEndpoint1.connect(webRtcEndpoint1);
    webRtcEndpoint2.connect(webRtcEndpoint2);
    webRtcEndpoint3.connect(webRtcEndpoint3);

    BrowserClient.Builder builderWebrtc = new BrowserClient.Builder()
        .browser(Browser.CHROME).client(Client.WEBRTC);

    try (BrowserClient browser1 = builderWebrtc.build();
        BrowserClient browser2 = builderWebrtc.build();
        BrowserClient browser3 = builderWebrtc.build()) {

      // Start WebRTC in loopback in each browser
      browser1.subscribeEvents("playing");
      browser1.connectToWebRtcEndpoint(webRtcEndpoint1,
          WebRtcChannel.AUDIO_AND_VIDEO);

      // Delay time (to avoid the same timing in videos)
      Thread.sleep(1000);

      // Browser 2
      browser2.subscribeEvents("playing");
      browser2.connectToWebRtcEndpoint(webRtcEndpoint2,
          WebRtcChannel.AUDIO_AND_VIDEO);

      // Delay time (to avoid the same timing in videos)
      Thread.sleep(1000);

      // Browser 3
      browser3.subscribeEvents("playing");
      browser3.connectToWebRtcEndpoint(webRtcEndpoint3,
          WebRtcChannel.AUDIO_AND_VIDEO);

      // Wait until event playing in the remote streams
      Assert.assertTrue("Timeout waiting playing event",
          browser1.waitForEvent("playing"));
      Assert.assertTrue("Timeout waiting playing event",
          browser2.waitForEvent("playing"));
      Assert.assertTrue("Timeout waiting playing event",
          browser3.waitForEvent("playing"));

      // Guard time to see each browser in loopback
      Thread.sleep(4000);
      assertColor(browser1, browser2, browser3);

      // Switching (round #1)
      webRtcEndpoint1.connect(webRtcEndpoint2);
      webRtcEndpoint2.connect(webRtcEndpoint3);
      webRtcEndpoint3.connect(webRtcEndpoint1);
      assertColor(browser1, browser2, browser3);

      // Guard time to see switching #1
      Thread.sleep(4000);

      // Switching (round #2)
      webRtcEndpoint1.connect(webRtcEndpoint3);
      webRtcEndpoint2.connect(webRtcEndpoint1);
      webRtcEndpoint3.connect(webRtcEndpoint2);
      assertColor(browser1, browser2, browser3);

      // Guard time to see switching #2
      Thread.sleep(4000);
    }
View Full Code Here

  }

  public void doTest(Browser browserType) throws Exception {
    // Media Pipeline
    MediaPipeline mp = pipelineFactory.create();
    WebRtcEndpoint webRtcEP1 = mp.newWebRtcEndpoint().build();
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();

    Dispatcher dispatcher = mp.newDispatcher().build();
    HubPort hubPort1 = dispatcher.newHubPort().build();
    HubPort hubPort2 = dispatcher.newHubPort().build();

    webRtcEP1.connect(hubPort1);
    hubPort2.connect(httpEP);

    dispatcher.connect(hubPort1, hubPort2);

    // Test execution
View Full Code Here

    public synchronized void onContentRequest(
        WebRtcContentSession contentSession) throws Exception {
      MediaPipeline mp = contentSession.getMediaPipelineFactory()
          .create();
      // contentSession.releaseOnTerminate(mp);
      WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
      recorderEndPoint = mp.newRecorderEndpoint(FILE_SCHEMA + recording)
          .build();
      webRtcEndpoint.connect(webRtcEndpoint);
      webRtcEndpoint.connect(recorderEndPoint);
      contentSession.start(webRtcEndpoint);

      terminateLatch = new CountDownLatch(1);
    }
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);

      terminateLatch = new CountDownLatch(1);
    }
View Full Code Here

  }

  public void doTest(Browser browserType) throws Exception {
    // Media Pipeline
    MediaPipeline mp = pipelineFactory.create();
    WebRtcEndpoint webRtcEP1 = mp.newWebRtcEndpoint().build();
    WebRtcEndpoint webRtcEP2 = mp.newWebRtcEndpoint().build();

    Dispatcher dispatcher = mp.newDispatcher().build();
    HubPort hubPort1 = dispatcher.newHubPort().build();
    HubPort hubPort2 = dispatcher.newHubPort().build();
View Full Code Here

        throws Exception {
      MediaPipeline mp = session.getMediaPipelineFactory().create();
      session.releaseOnTerminate(mp);
      PlayerEndpoint playerEP = mp.newPlayerEndpoint(
          "http://files.kurento.org/video/sintel.webm").build();
      WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
      playerEP.connect(webRtcEndpoint);
      playerEP.play();
      session.start(webRtcEndpoint);

      terminateLatch = new CountDownLatch(1);
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.