예제 #1
0
  public Videos getVideos(long minutes, int limit) throws CMException, BrightcoveException {
    ReadApi readApi = getReadApi();
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.MINUTE, -(int) minutes);
    long timeInMinutes = calendar.getTimeInMillis() / 1000l / 60l;

    return readApi.FindModifiedVideos(
        getReadToken(),
        timeInMinutes,
        Collections.singleton(VideoStateFilterEnum.PLAYABLE),
        limit,
        0,
        SortByTypeEnum.MODIFIED_DATE,
        SortOrderTypeEnum.DESC,
        FIELDS,
        CUSTOM_FIELDS);
  }
예제 #2
0
  public Videos search(String keyword, Type type, Sort sort, Order order) throws CMException {

    ReadApi api = getReadApi();

    Videos result = null;
    try {

      String token = getReadToken();
      switch (type) {
        case NAME:
          result = api.FindVideosByText(token, keyword, LIMIT, 0, FIELDS, CUSTOM_FIELDS);
          break;

        case TAG:
          Set<String> tags = new HashSet<String>(Arrays.asList(keyword.split(" ")));
          result =
              api.FindVideosByTags(
                  token,
                  EMPTY,
                  tags,
                  LIMIT,
                  0,
                  SortByTypeEnum.valueOf(sort.toString()),
                  SortOrderTypeEnum.valueOf(order.toString()),
                  FIELDS,
                  CUSTOM_FIELDS);
          break;

        case REFERENCE_ID:
          Set<String> ids = new HashSet<String>(Arrays.asList(keyword.split(" ")));
          result = api.FindVideosByReferenceIds(token, ids, FIELDS, CUSTOM_FIELDS);
          break;
      }
    } catch (BrightcoveException e) {
      throw new CMException(e.getMessage(), e);
    }

    return result;
  }
예제 #3
0
  public Video findByVideoID(long id) throws CMException, BrightcoveException {

    ReadApi api = getReadApi();
    return api.FindVideoById(getReadToken(), id, FIELDS, CUSTOM_FIELDS);
  }