Package com.kurento.kmf.repository

Examples of com.kurento.kmf.repository.RepositoryHttpRecorder


    itemId = "campus-party-" + Calendar.getInstance().getTimeInMillis();

    if (repositoryRecorder) {
      RepositoryItem repositoryItem = contentSession.getRepository()
          .createRepositoryItem(itemId);
      RepositoryHttpRecorder recorder = repositoryItem
          .createRepositoryHttpRecorder();
      getLogger().info(
          "repositoryRecorderUrl + recorder.getURL()" + recorderUrl
              + recorder.getURL());
      recorderEndpoint = mediaPipeline.newRecorderEndpoint(
          recorderUrl + recorder.getURL()).build();
    } else {
      recorderEndpoint = mediaPipeline.newRecorderEndpoint(
          "file:///tmp/" + itemId).build();
    }
    faceOverlayFilter.connect(recorderEndpoint);
View Full Code Here


  protected String uploadFile(File fileToUpload, RepositoryItem repositoryItem)
      throws FileNotFoundException, IOException {

    String id = repositoryItem.getId();

    RepositoryHttpRecorder recorder = repositoryItem
        .createRepositoryHttpRecorder();

    uploadFileWithMultiparts(recorder.getURL(), fileToUpload);

    recorder.stop();

    return id;
  }
View Full Code Here

  }

  private void uploadWithEvents(RepositoryItem repositoryItem,
      File fileToUpload) throws URISyntaxException,
      FileNotFoundException, IOException, InterruptedException {
    RepositoryHttpRecorder recorder = repositoryItem
        .createRepositoryHttpRecorder();

    final CountDownLatch started = new CountDownLatch(1);
    recorder.addSessionStartedListener(new RepositoryHttpEventListener<HttpSessionStartedEvent>() {
      @Override
      public void onEvent(HttpSessionStartedEvent event) {
        started.countDown();
      }
    });

    final CountDownLatch terminated = new CountDownLatch(1);
    recorder.addSessionTerminatedListener(new RepositoryHttpEventListener<HttpSessionTerminatedEvent>() {
      @Override
      public void onEvent(HttpSessionTerminatedEvent event) {
        terminated.countDown();
      }
    });

    uploadFileWithPOST(recorder.getURL(), fileToUpload);

    // TODO We need to be sure that this events appear in the order
    // specified. This test doesn't control this

    assertTrue("Started event didn't sent in 10 seconds",
View Full Code Here

          itemId);
    }

    repositoryItem = contentSession.getRepository().createRepositoryItem(
        itemId);
    RepositoryHttpRecorder recorder = repositoryItem
        .createRepositoryHttpRecorder();
    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)
View Full Code Here

  @Test
  public void testFileUploadAndDownload() throws Exception {

    RepositoryItem item = getRepository().createRepositoryItem();

    final RepositoryHttpRecorder recorder = item
        .createRepositoryHttpRecorder();

    final CountDownLatch started = new CountDownLatch(1);
    recorder.addSessionStartedListener(new RepositoryHttpEventListener<HttpSessionStartedEvent>() {
      @Override
      public void onEvent(HttpSessionStartedEvent event) {
        started.countDown();
      }
    });

    final CountDownLatch errorLatch = new CountDownLatch(1);
    recorder.addSessionErrorListener(new RepositoryHttpEventListener<HttpSessionErrorEvent>() {
      @Override
      public void onEvent(HttpSessionErrorEvent event) {
        log.info("Error event sent");
        log.info("Exception:" + event.getCause());
        errorLatch.countDown();
      }
    });

    log.info("Start writing to URL " + recorder.getURL()
        + " the item with id '" + item.getId() + "'");

    new Thread() {
      public void run() {
        try {
          uploadFileWithPOST(recorder.getURL(), new File(
              "test-files/logo.png"));
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
View Full Code Here

    RepositoryItem repositoryItem = getRepository().createRepositoryItem();

    String id = repositoryItem.getId();

    File fileToUpload = new File("test-files/sample.txt");
    RepositoryHttpRecorder recorder = repositoryItem
        .createRepositoryHttpRecorder();

    uploadFileWithPOST(recorder.getURL(), fileToUpload);

    recorder.stop();

    RepositoryItem newRepositoryItem = getRepository()
        .findRepositoryItemById(id);

    File downloadedFile = new File("test-files/tmp/" + id);
View Full Code Here

  }

  private void prepareToUploadVideo(RepositoryItem repositoryItem)
      throws InterruptedException {

    RepositoryHttpRecorder recorder = repositoryItem
        .createRepositoryHttpRecorder("video-upload");

    log.info("The video must be uploaded with PUT or POST to the URL: "
        + recorder.getURL());

    readyToUploadWatch.countDown();

    recorder.setAutoTerminationTimeout(5 * 1000);
    log.info("The recorder will be auto-terminated 5 seconds after the last uploading of content (http PUT or POST)");

    final CountDownLatch terminatedLatch = new CountDownLatch(1);

    recorder.addSessionStartedListener(new RepositoryHttpEventListener<HttpSessionStartedEvent>() {
      @Override
      public void onEvent(HttpSessionStartedEvent event) {
        log.info("Uploading started");
      }
    });

    recorder.addSessionTerminatedListener(new RepositoryHttpEventListener<HttpSessionTerminatedEvent>() {
      @Override
      public void onEvent(HttpSessionTerminatedEvent event) {
        log.info("Uploading terminated");
        terminatedLatch.countDown();
      }
View Full Code Here

TOP

Related Classes of com.kurento.kmf.repository.RepositoryHttpRecorder

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.