Package com.kurento.kmf.media

Examples of com.kurento.kmf.media.PlayerEndpoint


      throws Exception {

    MediaPipelineFactory mpf = session.getMediaPipelineFactory();
    MediaPipeline mp = mpf.create();

    PlayerEndpoint player = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/barcodes.webm").build();
    session.setAttribute("player", player);

    ZBarFilter zBarFilter = mp.newZBarFilter().build();
    player.connect(zBarFilter);
    HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    zBarFilter.connect(httpEP);
    session.start(httpEP);
    session.setAttribute("eventValue", "");
View Full Code Here


  }

  @Override
  public void onContentStarted(HttpPlayerSession session) {
    PlayerEndpoint playerEndpoint = (PlayerEndpoint) session
        .getAttribute("player");
    playerEndpoint.play();
  }
View Full Code Here

   */
  @Test
  public void testEventMediaSessionStarted() throws InterruptedException,
      ClientProtocolException, IOException {

    final PlayerEndpoint player = pipeline.newPlayerEndpoint(URL_SMALL)
        .build();

    HttpGetEndpoint httpEP = pipeline.newHttpGetEndpoint().build();
    player.connect(httpEP);

    AsyncEventManager<EndOfStreamEvent> async = new AsyncEventManager<>(
        "EndOfStream event");

    player.addEndOfStreamListener(async.getMediaEventListener());

    httpEP.addMediaSessionStartedListener(new MediaEventListener<MediaSessionStartedEvent>() {
      @Override
      public void onEvent(MediaSessionStartedEvent event) {
        player.play();
      }
    });

    try (CloseableHttpClient httpclient = HttpClientBuilder.create()
        .build()) {
      // This should trigger MediaSessionStartedEvent
      httpclient.execute(new HttpGet(httpEP.getUrl()));
    }

    async.waitForResult();

    httpEP.release();
    player.release();
  }
View Full Code Here

   * @throws ClientProtocolException
   */
  @Test
  public void testEventMediaSessionTerminated() throws InterruptedException,
      ClientProtocolException, IOException {
    final PlayerEndpoint player = pipeline.newPlayerEndpoint(URL_SMALL)
        .build();
    HttpGetEndpoint httpEP = pipeline.newHttpGetEndpoint().terminateOnEOS()
        .build();
    player.connect(httpEP);

    httpEP.addMediaSessionStartedListener(new MediaEventListener<MediaSessionStartedEvent>() {

      @Override
      public void onEvent(MediaSessionStartedEvent event) {
        player.play();
      }
    });

    final BlockingQueue<MediaSessionTerminatedEvent> events = new ArrayBlockingQueue<>(
        1);
    httpEP.addMediaSessionTerminatedListener(new MediaEventListener<MediaSessionTerminatedEvent>() {

      @Override
      public void onEvent(MediaSessionTerminatedEvent event) {
        events.add(event);
      }
    });

    try (CloseableHttpClient httpclient = HttpClientBuilder.create()
        .build()) {
      // This should trigger MediaSessionStartedEvent
      httpclient.execute(new HttpGet(httpEP.getUrl()));
    }

    Assert.assertNotNull("MediaSessionTerminatedEvent not sent in 20s",
        events.poll(20, SECONDS));

    httpEP.release();
    player.release();
  }
View Full Code Here

  @Override
  public void onContentRequest(HttpPlayerSession session) throws Exception {
    MediaPipelineFactory mpf = session.getMediaPipelineFactory();
    MediaPipeline mp = mpf.create();
    session.releaseOnTerminate(mp);
    PlayerEndpoint playerEndpoint = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/fiwarecut.webm").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

    session.start(httpEP);
  }

  @Override
  public void onContentStarted(HttpPlayerSession session) {
    PlayerEndpoint playerEndpoint = (PlayerEndpoint) session
        .getAttribute("player");
    playerEndpoint.play();
  }
View Full Code Here

   *
   * @throws InterruptedException
   */
  @Test
  public void testFaceOverlayFilter() throws InterruptedException {
    PlayerEndpoint player = pipeline
        .newPlayerEndpoint(URL_POINTER_DETECTOR).build();
    player.connect(overlayFilter);

    AsyncEventManager<EndOfStreamEvent> async = new AsyncEventManager<>(
        "EndOfStream event");

    player.addEndOfStreamListener(async.getMediaEventListener());

    player.play();

    async.waitForResult();

    player.stop();
    player.release();
  }
View Full Code Here

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

    // Media Elements: Player Endpoint, Filter, HTTP Endpoint
    PlayerEndpoint playerEndpoint = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/fiwarecut.webm").build();
    contentSession.setAttribute("player", playerEndpoint);
    JackVaderFilter filter = mp.newJackVaderFilter().build();
    HttpGetEndpoint httpEndpoint = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();

    // Connections
    filter.connect(httpEndpoint);
    playerEndpoint.connect(filter);

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

    contentSession.start(httpEndpoint);
  }

  @Override
  public void onContentStarted(HttpPlayerSession contentSession) {
    PlayerEndpoint playerEndpoint = (PlayerEndpoint) contentSession
        .getAttribute("player");
    playerEndpoint.play();
  }
View Full Code Here

    MediaPipelineFactory kurento = KmfMediaApi
        .createMediaPipelineFactoryFromSystemProps();

    MediaPipeline pipeline = kurento.create();

    PlayerEndpoint player = pipeline.newPlayerEndpoint(
        "http://files.kurento.org/video/fiwarecut.mp4").build();
    // player.addEndOfStreamListener(new
    // MediaEventListener<EndOfStreamEvent>() {
    //
    // @Override
    // public void onEvent(EndOfStreamEvent event) {
    // System.out.println("Finish");
    // System.exit(0);
    // }
    // });

    FaceOverlayFilter filter = pipeline.newFaceOverlayFilter().build();
    filter.setOverlayedImage(
        "http://files.kurento.org/imgs/mario-wings.png", -0.35F, -1.2F,
        1.6F, 1.6F);

    HttpGetEndpoint recorder = pipeline.newHttpGetEndpoint().build();

    // RecorderEndpoint recorder = pipeline.newRecorderEndpoint(
    // "file:///home/mica/Data/Kurento/tmp/video.mp4").build();

    player.connect(filter);
    filter.connect(recorder);

    player.play();

    Desktop.getDesktop().browse(new URI(recorder.getUrl()));

  }
View Full Code Here

TOP

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

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.