Package com.kurento.kmf.media

Examples of com.kurento.kmf.media.MediaPipeline


  public void onContentRequest(final HttpPlayerSession contentSession)
      throws Exception {
    // contentSession.start("http://files.kurento.org/video/sintel.webm");

    MediaPipelineFactory mpf = contentSession.getMediaPipelineFactory();
    final MediaPipeline mp = mpf.create();
    contentSession.releaseOnTerminate(mp);
    PlayerEndpoint playerEndpoint = mp.newPlayerEndpoint(
        "http://files.kurento.org/video/sintel.webm").build();
    HttpGetEndpoint httpEndpoint = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    playerEndpoint.connect(httpEndpoint);
    contentSession.setAttribute("player", playerEndpoint);
    contentSession.start(httpEndpoint);

    playerEndpoint
        .addEndOfStreamListener(new MediaEventListener<EndOfStreamEvent>() {
          @Override
          public void onEvent(EndOfStreamEvent event) {
            PlayerEndpoint newPlayerEndpoint = mp
                .newPlayerEndpoint(
                    "http://media.w3.org/2010/05/sintel/trailer.webm")
                .build();
            newPlayerEndpoint.play();
            // contentSession
View Full Code Here


  @Override
  public synchronized void onContentRequest(
      WebRtcContentSession contentSession) throws Exception {
    String contentId = contentSession.getContentId();
    if (firstWebRtcEndpoint == null) {
      MediaPipeline mp = contentSession.getMediaPipelineFactory()
          .create();
      contentSession.releaseOnTerminate(mp);

      firstWebRtcEndpoint = mp.newWebRtcEndpoint().build();
      sessionId = contentSession.getSessionId();
      contentSession.releaseOnTerminate(firstWebRtcEndpoint);
      firstWebRtcEndpoint.connect(firstWebRtcEndpoint);

      if (contentId != null && contentId.equalsIgnoreCase("record")) {
        RecorderEndpoint recorderEndPoint = mp.newRecorderEndpoint(
            "file:///tmp/master").build();
        contentSession.setAttribute("recorder", recorderEndPoint);
        firstWebRtcEndpoint.connect(recorderEndPoint);
      }

      contentSession.start(firstWebRtcEndpoint);
    } else {
      MediaPipeline mp = firstWebRtcEndpoint.getMediaPipeline();

      WebRtcEndpoint newWebRtcEndpoint = mp.newWebRtcEndpoint().build();
      contentSession.releaseOnTerminate(newWebRtcEndpoint);
      newWebRtcEndpoint.connect(firstWebRtcEndpoint);
      firstWebRtcEndpoint.connect(newWebRtcEndpoint);

      if (contentId != null && contentId.equalsIgnoreCase("record")) {
        RecorderEndpoint recorderEndPoint = mp.newRecorderEndpoint(
            "file:///tmp/peer").build();
        contentSession.setAttribute("recorder", recorderEndPoint);
        newWebRtcEndpoint.connect(recorderEndPoint);
      }
View Full Code Here

public class CpPlayerHandler extends HttpPlayerHandler {

  @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();
    session.setAttribute("player", playerEndpoint);
    HttpGetEndpoint httpEndpoint = mp.newHttpGetEndpoint().terminateOnEOS()
        .build();
    playerEndpoint.connect(httpEndpoint);
    session.start(httpEndpoint);
  }
View Full Code Here

  public static JackVaderFilter sharedFilterReference;

  @Override
  public void onContentRequest(RtpContentSession session) throws Exception {
    MediaPipelineFactory mpf = session.getMediaPipelineFactory();
    MediaPipeline mp = mpf.create();
    session.releaseOnTerminate(mp);
    JackVaderFilter filter = mp.newJackVaderFilter().build();
    RtpEndpoint rtpEndpoint = mp.newRtpEndpoint().build();
    rtpEndpoint.connect(filter);
    rtpEndpoint.connect(rtpEndpoint);
    session.start(rtpEndpoint);
    sharedFilterReference = filter;
  }
View Full Code Here

  public static JackVaderFilter filter;

  @Override
  public void onContentRequest(WebRtcContentSession contentSession)
      throws Exception {
    MediaPipeline mp = contentSession.getMediaPipelineFactory().create();
    contentSession.releaseOnTerminate(mp);
    filter = mp.newJackVaderFilter().build();
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    webRtcEndpoint.connect(filter);
    filter.connect(webRtcEndpoint);
    contentSession.start(webRtcEndpoint);
  }
View Full Code Here

  public static ZBarFilter sharedFilterReference;

  @Override
  public void onContentRequest(RtpContentSession session) throws Exception {
    MediaPipelineFactory mpf = session.getMediaPipelineFactory();
    MediaPipeline mp = mpf.create();
    session.releaseOnTerminate(mp);
    ZBarFilter filter = mp.newZBarFilter().build();
    RtpEndpoint rtpEndpoint = mp.newRtpEndpoint().build();
    rtpEndpoint.connect(filter);
    rtpEndpoint.connect(rtpEndpoint);
    session.start(rtpEndpoint);
    sharedFilterReference = filter;
  }
View Full Code Here

      mediaElement = WebRtcLoopback.webRtcEndpoint;
    }
    if (mediaElement == null) {
      session.terminate(400, "WebRTC source is not running");
    } else {
      MediaPipeline mp = mediaElement.getMediaPipeline();
      HttpGetEndpoint httpEndpoint = mp.newHttpGetEndpoint()
          .terminateOnEOS().build();
      mediaElement.connect(httpEndpoint);
      session.start(httpEndpoint);
    }
  }
View Full Code Here

        + "://" + config.getHandlerAddress() + ":"
        + contentSession.getHttpServletRequest().getServerPort()
        + contentSession.getHttpServletRequest().getContextPath()
        + "/img/masks/mario-wings.png";

    MediaPipeline mp = contentSession.getMediaPipelineFactory().create();
    contentSession.releaseOnTerminate(mp);
    filter = mp.newFaceOverlayFilter().build();
    filter.setOverlayedImage(imageUrl, -0.35F, -1.2F, 1.6F, 1.6F);
    WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
    webRtcEndpoint.connect(filter);
    filter.connect(webRtcEndpoint);
    contentSession.start(webRtcEndpoint);
  }
View Full Code Here

        url = VideoURLs.map.get(contentId);
      }
      if (contentId != null && contentId.equalsIgnoreCase("jack")) {
        // Jack Vader Filter
        MediaPipelineFactory mpf = session.getMediaPipelineFactory();
        MediaPipeline mp = mpf.create();
        session.releaseOnTerminate(mp);
        PlayerEndpoint playerEndPoint = mp.newPlayerEndpoint(url)
            .build();
        JackVaderFilter filter = mp.newJackVaderFilter().build();
        playerEndPoint.connect(filter);
        HttpGetEndpoint httpEndpoint = mp.newHttpGetEndpoint()
            .terminateOnEOS().build();
        filter.connect(httpEndpoint);
        session.setAttribute("player", playerEndPoint);
        session.start(httpEndpoint);
      } else if (contentId != null && contentId.equalsIgnoreCase("zbar")) {
        // ZBar Filter
        MediaPipelineFactory mpf = session.getMediaPipelineFactory();
        MediaPipeline mp = mpf.create();
        PlayerEndpoint player = mp.newPlayerEndpoint(url).build();
        session.setAttribute("player", player);
        ZBarFilter zBarFilter = mp.newZBarFilter().build();
        player.connect(zBarFilter);
        HttpGetEndpoint httpEndpoint = mp.newHttpGetEndpoint()
            .terminateOnEOS().build();
        zBarFilter.connect(httpEndpoint);
        session.start(httpEndpoint);
        session.setAttribute("eventValue", "");
        zBarFilter
View Full Code Here

    String mediaUrl = contentSession.getHttpServletRequest().getScheme()
        + "://" + config.getHandlerAddress() + ":"
        + contentSession.getHttpServletRequest().getServerPort()
        + recorder.getURL();

    MediaPipeline mp = contentSession.getMediaPipelineFactory().create();
    contentSession.releaseOnTerminate(mp);

    RecorderEndpoint recorderEndPoint = mp.newRecorderEndpoint(mediaUrl)
        .build();

    JackVaderFilter filter = mp.newJackVaderFilter().build();
    filter.connect(recorderEndPoint);
    contentSession.setAttribute("recorder", recorderEndPoint);
    HttpPostEndpoint httpEndpoint = mp.newHttpPostEndpoint().build();
    httpEndpoint.connect(filter);
    contentSession.start(httpEndpoint);
  }
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.