Package com.kurento.kmf.media

Examples of com.kurento.kmf.media.PlayerEndpoint


    contentSession.start(httpEndpoint);
  }

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


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

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

    player.connect(httpEp);

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

    player.addEndOfStreamListener(async.getMediaEventListener());

    AsyncResultManager<ListenerRegistration> async2 = new AsyncResultManager<ListenerRegistration>(
        "EventListener subscription");

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

    async2.waitForResult();

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

    async.waitForResult();
    player.release();
  }
View Full Code Here

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

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

    player.connect(httpEp);

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

    AsyncResultManager<ListenerRegistration> async = new AsyncResultManager<>(
        "EventListener subscription");

    AsyncEventManager<MediaSessionTerminatedEvent> asyncEvent = new AsyncEventManager<>(
        "MediaSessionTerminated event");

    httpEp.addMediaSessionTerminatedListener(
        asyncEvent.getMediaEventListener(), async.getContinuation());

    async.waitForResult();

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

    asyncEvent.waitForResult();
    player.release();

  }
View Full Code Here

  }

  @Test
  public void testCodeFoundEvent() throws InterruptedException {

    PlayerEndpoint player = pipeline.newPlayerEndpoint(URL_BARCODES)
        .build();
    player.connect(zbar);

    AsyncEventManager<CodeFoundEvent> async = new AsyncEventManager<>(
        "CodeFound event");

    zbar.addCodeFoundListener(async.getMediaEventListener());

    player.play();

    async.waitForResult();

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

  @Test
  public void testRtpEndpointSimulatingAndroidSdp()
      throws InterruptedException {

    PlayerEndpoint player = pipeline.newPlayerEndpoint(URL_BARCODES)
        .build();

    RtpEndpoint rtpEndpoint = pipeline.newRtpEndpoint().build();

    String requestSdp = "v=0\r\n"
        + "o=- 12345 12345 IN IP4 95.125.31.136\r\n" + "s=-\r\n"
        + "c=IN IP4 95.125.31.136\r\n" + "t=0 0\r\n"
        + "m=video 52126 RTP/AVP 96 97 98\r\n"
        + "a=rtpmap:96 H264/90000\r\n"
        + "a=rtpmap:97 MP4V-ES/90000\r\n"
        + "a=rtpmap:98 H263-1998/90000\r\n" + "a=recvonly\r\n"
        + "b=AS:384\r\n";

    rtpEndpoint.processOffer(requestSdp);
    player.connect(rtpEndpoint, MediaType.VIDEO);
    player.play();

    // just a little bit of time before destroying
    Thread.sleep(2000);
  }
View Full Code Here

   *
   * @throws InterruptedException
   */
  @Test
  public void testJackVaderFilter() throws InterruptedException {
    PlayerEndpoint player = pipeline.newPlayerEndpoint(URL_SMALL).build();
    player.connect(jackVader);

    final BlockingQueue<EndOfStreamEvent> events = new ArrayBlockingQueue<EndOfStreamEvent>(
        1);
    player.addEndOfStreamListener(new MediaEventListener<EndOfStreamEvent>() {

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

    player.play();

    Assert.assertNotNull("EndOfStreamEvent not sent in 10s",
        events.poll(10, SECONDS));

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

  }

  @Test
  public void testConnect() throws InterruptedException {

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

    HttpEndpoint http = pipeline.newHttpGetEndpoint().build();

    AsyncResultManager<Void> async = new AsyncResultManager<>(
        "player.connect() invocation");
    player.connect(http, async.getContinuation());
    async.waitForResult();

    player.play();
    http.release();
    player.release();
  }
View Full Code Here

    player.release();
  }

  @Test
  public void testConnectByType() throws InterruptedException {
    PlayerEndpoint player = pipeline.newPlayerEndpoint(URL_SMALL).build();
    HttpEndpoint http = pipeline.newHttpGetEndpoint().build();

    AsyncResultManager<Void> asyncAudio = new AsyncResultManager<>(
        "player.connect(AUDIO) invocation");
    player.connect(http, AUDIO, asyncAudio.getContinuation());
    asyncAudio.waitForResult();

    AsyncResultManager<Void> asyncVideo = new AsyncResultManager<>(
        "player.connect() invocation");
    player.connect(http, VIDEO, asyncVideo.getContinuation());
    asyncVideo.waitForResult();

    player.play();
    http.release();
    player.release();
  }
View Full Code Here

    server.start();

    MediaPipeline pipeline = mpf.create();

    PlayerEndpoint player = pipeline.newPlayerEndpoint(
        "http://files.kurento.org/video/small.webm").build();

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

    player.connect(httpGetEndpoint);

    String url = httpGetEndpoint.getUrl();

    player.release();

    Assert.assertNotSame("The URL shouldn't be empty", "", url);

    KurentoServicesTestHelper.teardownServices();
View Full Code Here

      getLogger().info(
          "Activating media for " + this.getClass().getSimpleName()
              + " with contentPath " + contentPath);

      final PlayerEndpoint playerEndPoint = buildUriEndpoint(contentPath);
      HttpEndpoint httpEndpoint = buildAndConnectHttpEndpoint(playerEndPoint);

      activateMedia(httpEndpoint, new Runnable() {
        @Override
        public void run() {
          playerEndPoint.play();

        }
      });
    } catch (KurentoMediaFrameworkException ke) {
      internalTerminateWithError(null, ke.getCode(), ke.getMessage(),
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.