Package com.kurento.kmf.media

Examples of com.kurento.kmf.media.MediaPipeline


  @Ignore
  @Test
  public void testPlayerPlateDetector() throws Exception {
    // Media Pipeline
    MediaPipeline mp = pipelineFactory.create();
    PlayerEndpoint playerEP = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/plates.webm").build();
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    PlateDetectorFilter plateDetectorFilter = mp.newPlateDetectorFilter()
        .build();
    playerEP.connect(plateDetectorFilter);
    plateDetectorFilter.connect(httpEP);
    plateDetectorFilter.setPlateWidthPercentage((float) 0.3);
View Full Code Here


    doTest(Browser.CHROME);
  }

  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);
View Full Code Here

    private RecorderEndpoint recorderEndPoint;

    @Override
    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);
View Full Code Here

    private PlayerEndpoint playerEP;

    @Override
    public void onContentRequest(HttpPlayerSession session)
        throws Exception {
      MediaPipeline mp = session.getMediaPipelineFactory().create();
      playerEP = mp.newPlayerEndpoint(FILE_SCHEMA + recording).build();
      HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
          .build();
      playerEP.connect(httpEP);
      session.start(httpEP);

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

    doTest(Browser.FIREFOX);
  }

  public void doTest(Browser browserType) throws Exception {
    // Media Pipeline
    MediaPipeline mp = pipelineFactory.create();
    PlayerEndpoint playerRed = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/60sec/red.webm").build();
    PlayerEndpoint playerGreen = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/60sec/green.webm").build();
    PlayerEndpoint playerBlue = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/60sec/blue.webm").build();
    PlayerEndpoint playerWhite = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/60sec/white.webm").build();

    Composite composite = mp.newComposite().build();
    HubPort hubPort1 = composite.newHubPort().build();
    HubPort hubPort2 = composite.newHubPort().build();
    HubPort hubPort3 = composite.newHubPort().build();
    HubPort hubPort4 = composite.newHubPort().build();
    HubPort hubPort5 = composite.newHubPort().build();

    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    playerRed.connect(hubPort1);
    playerGreen.connect(hubPort2);
    playerBlue.connect(hubPort3);
    playerWhite.connect(hubPort4);
View Full Code Here

    doTest(Browser.CHROME);
  }

  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();

    webRtcEP1.connect(hubPort1);
    hubPort2.connect(webRtcEP2);
View Full Code Here

  public static class WebRtcHandler extends WebRtcContentHandler {

    @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

      throws Exception {
    EventListener.clearEventList();
    EventListener.addEvent();

    MediaPipelineFactory mpf = contentSession.getMediaPipelineFactory();
    MediaPipeline mp = mpf.create();
    contentSession.releaseOnTerminate(mp);
    PlayerEndpoint playerEndpoint = mp.newPlayerEndpoint("").build();
    contentSession.setAttribute("player", playerEndpoint);
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    playerEndpoint.connect(httpEP);
    contentSession.start(httpEP);
  }
View Full Code Here

  public static class WebRtcHandler extends WebRtcContentHandler {

    @Override
    public void onContentRequest(WebRtcContentSession session)
        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

  }

  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();
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    playerEP.connect(httpEP);

    // Test execution #2. Play the recorded video
    try (BrowserClient browser = new BrowserClient.Builder()
View Full Code Here

TOP

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

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.