Package com.kurento.kmf.media

Examples of com.kurento.kmf.media.HttpGetEndpoint


      PlayerEndpoint playerEndpoint = mp.newPlayerEndpoint(mediaUrl)
          .build();
      JackVaderFilter filter = mp.newJackVaderFilter().build();
      playerEndpoint.connect(filter);
      contentSession.setAttribute("player", playerEndpoint);
      HttpGetEndpoint httpEndpoint = mp.newHttpGetEndpoint()
          .terminateOnEOS().build();
      filter.connect(httpEndpoint);
      contentSession.start(httpEndpoint);
    }
  }
View Full Code Here


      }
    });
    session.setAttribute("player", playerEndpoint);

    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    filter.connect(httpEP);
    session.start(httpEP);
  }
View Full Code Here

    PlayerEndpoint playerEndpoint = mp.newPlayerEndpoint(
        VideoURLs.map.get("jack")).build();
    JackVaderFilter filter = mp.newJackVaderFilter().build();
    playerEndpoint.connect(filter);
    session.setAttribute("player", playerEndpoint);
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    filter.connect(httpEP);
    session.start(httpEP);
  }
View Full Code Here

  public void testPlayerCrowdDetector() throws Exception {
    // Media Pipeline
    MediaPipeline mp = pipelineFactory.create();
    PlayerEndpoint playerEP = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/crowd.mp4").build();
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();

    List<RegionOfInterest> rois = newArrayList();
    List<RelativePoint> points = new ArrayList<RelativePoint>();

    points.add(new RelativePoint(0, 0));
    points.add(new RelativePoint((float) 0.5, 0));
    points.add(new RelativePoint((float) 0.5, (float) 0.5));
    points.add(new RelativePoint(0, (float) 0.5));

    RegionOfInterestConfig config = new RegionOfInterestConfig();

    config.setFluidityLevelMin(10);
    config.setFluidityLevelMed(35);
    config.setFluidityLevelMax(65);
    config.setFluidityNumFramesToEvent(5);
    config.setOccupancyLevelMin(10);
    config.setOccupancyLevelMed(35);
    config.setOccupancyLevelMax(65);
    config.setOccupancyNumFramesToEvent(5);
    config.setSendOpticalFlowEvent(false);
    config.setOpticalFlowNumFramesToEvent(3);
    config.setOpticalFlowNumFramesToReset(3);
    config.setOpticalFlowAngleOffset(0);

    rois.add(new RegionOfInterest(points, config, "roi0"));

    CrowdDetectorFilter crowdDetectorFilter = mp.newCrowdDetectorFilter(
        rois).build();
    playerEP.connect(crowdDetectorFilter);
    crowdDetectorFilter.connect(httpEP);

    final List<EndOfStreamEvent> eosEvents = new ArrayList<>();
    playerEP.addEndOfStreamListener(new MediaEventListener<EndOfStreamEvent>() {
      @Override
      public void onEvent(EndOfStreamEvent event) {
        eosEvents.add(event);
      }
    });

    final List<CrowdDetectorOccupancyEvent> crowdDetectedOccupancyEvents = new ArrayList<>();
    final List<CrowdDetectorFluidityEvent> crowdDetectedFluidityEvents = new ArrayList<>();

    crowdDetectorFilter
        .addCrowdDetectorOccupancyListener(new MediaEventListener<CrowdDetectorOccupancyEvent>() {
          @Override
          public void onEvent(CrowdDetectorOccupancyEvent event) {
            crowdDetectedOccupancyEvents.add(event);
          }
        });

    crowdDetectorFilter
        .addCrowdDetectorFluidityListener(new MediaEventListener<CrowdDetectorFluidityEvent>() {
          @Override
          public void onEvent(CrowdDetectorFluidityEvent event) {
            crowdDetectedFluidityEvents.add(event);
          }
        });

    // Test execution
    try (BrowserClient browser = new BrowserClient.Builder()
        .browser(Browser.CHROME).client(Client.PLAYER).build()) {
      browser.setURL(httpEP.getUrl());
      browser.subscribeEvents("playing", "ended");
      playerEP.play();
      browser.start();

      // Assertions
View Full Code Here

      MediaPipelineFactory mpf = session.getMediaPipelineFactory();
      MediaPipeline mp = mpf.create();
      session.releaseOnTerminate(mp);
      PlayerEndpoint playerEndpoint = mp.newPlayerEndpoint(url).build();
      HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
          .build();
      if (contentId != null && contentId.equalsIgnoreCase("jack")) {
        // Jack Vader Filter
        JackVaderFilter filter = mp.newJackVaderFilter().build();
        playerEndpoint.connect(filter);
View Full Code Here

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

  public void doTest(Browser browserType) throws Exception {
    // Media Pipeline #1
    MediaPipeline mp = pipelineFactory.create();
    PlayerEndpoint playerEP = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/fiwarecut.mp4").build();
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    RecorderEndpoint recorderEP = mp.newRecorderEndpoint(
        FILE_SCHEMA + getDefaultFileForRecording()).build();
    final FaceOverlayFilter filter = mp.newFaceOverlayFilter().build();
    filter.setOverlayedImage(
        "http://files.kurento.org/imgs/mario-wings.png", -0.2F, -1.2F,
        1.6F, 1.6F);

    playerEP.connect(filter);
    filter.connect(httpEP);
    filter.connect(recorderEP);

    // Test execution #1. Play and record
    launchBrowser(browserType, httpEP, playerEP, recorderEP);

    // Media Pipeline #2
    PlayerEndpoint playerEP2 = mp.newPlayerEndpoint(
        FILE_SCHEMA + getDefaultFileForRecording()).build();
    HttpGetEndpoint httpEP2 = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    playerEP2.connect(httpEP2);

    // Test execution #2. Play the recorded video
    launchBrowser(browserType, httpEP2, playerEP2, null);
View Full Code Here

        "http://files.kurento.org/video/10sec/red.webm").build();
    PlayerEndpoint playerGreen = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/10sec/green.webm").build();
    PlayerEndpoint playerBlue = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/10sec/blue.webm").build();
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    RecorderEndpoint recorderEP = mp.newRecorderEndpoint(
        FILE_SCHEMA + getDefaultFileForRecording()).build();

    try (BrowserClient browser = new BrowserClient.Builder()
        .browser(browserType).client(Client.PLAYER).build()) {
      browser.setURL(httpEP.getUrl());

      // red
      playerRed.connect(httpEP);
      playerRed.connect(recorderEP);
      playerRed.play();
      recorderEP.record();
      browser.subscribeEvents("playing", "ended");
      browser.start();
      Assert.assertTrue("Timeout waiting playing event",
          browser.waitForEvent("playing"));
      Thread.sleep(2000);

      // green
      playerGreen.connect(httpEP);
      playerGreen.connect(recorderEP);
      playerGreen.play();
      Thread.sleep(6000);

      // blue
      playerBlue.connect(httpEP);
      playerBlue.connect(recorderEP);
      playerBlue.play();
      Thread.sleep(6000);

      // Assertions
      Assert.assertTrue("Timeout waiting ended event",
          browser.waitForEvent("ended"));
      Assert.assertTrue("Play time must be at least " + PLAYTIME
          + " seconds", browser.getCurrentTime() >= PLAYTIME);

    }

    // Stop and release media elements
    recorderEP.stop();
    playerRed.stop();
    playerGreen.stop();
    playerBlue.stop();
    recorderEP.release();
    playerRed.release();
    playerGreen.release();
    playerBlue.release();

    // Media Pipeline #2
    PlayerEndpoint playerEP2 = mp.newPlayerEndpoint(
        FILE_SCHEMA + getDefaultFileForRecording()).build();
    HttpGetEndpoint httpEP2 = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    playerEP2.connect(httpEP2);

    try (BrowserClient browser = new BrowserClient.Builder()
        .browser(browserType).client(Client.PLAYER).build()) {
      browser.setURL(httpEP2.getUrl());
      browser.subscribeEvents("playing", "ended");
      playerEP2.play();

      browser.start();
View Full Code Here

      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

  public void doTest(Browser browserType) throws Exception {
    // Media Pipeline #1
    MediaPipeline mp = pipelineFactory.create();
    PlayerEndpoint playerEP = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/10sec/green.webm").build();
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    RecorderEndpoint recorderEP = mp.newRecorderEndpoint(
        FILE_SCHEMA + getDefaultFileForRecording()).build();
    playerEP.connect(httpEP);
    playerEP.connect(recorderEP);

    // Test execution #1. Play the video while it is recorded
    launchBrowser(browserType, httpEP, playerEP, recorderEP);

    // Media Pipeline #2
    PlayerEndpoint playerEP2 = mp.newPlayerEndpoint(
        FILE_SCHEMA + getDefaultFileForRecording()).build();
    HttpGetEndpoint httpEP2 = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    playerEP2.connect(httpEP2);

    // Test execution #2. Play the recorded video
    launchBrowser(browserType, httpEP2, playerEP2, null);
View Full Code Here

TOP

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

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.