com.aliyun.svideosdk.common

## Interface AliyunIThumbnailFetcher

-     public interface AliyunIThumbnailFetcher

  视频缩略图获取接口

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `AliyunIThumbnailFetcher.CropMode`
    `static interface` | `AliyunIThumbnailFetcher.OnThumbnailCompletion`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `addImageSource(java.lang.String path, long durationMills, long overlapDurationMills)` 添加图片源（图片转视频时用到）
    `int` | `addVideoSource(java.lang.String path)` Deprecated. 请使用 `addVideoSource(String, long, long, long)`
    `int` | `addVideoSource(java.lang.String path, long startTimeMills, long endTimeMills, long overlapDurationMills)` 添加视频源
    `int` | `fromConfigJson(java.lang.String jsonPath)` 从配置文件加载视频信息（适用于SDK内操作产生的project.json）
    `long` | `getTotalDuration()` 获取总时长，该接口必须在`addVideoSource(String, long, long, long)`之后调用
    `void` | `release()` 释放资源
    `int` | `requestThumbnailImage(int count, AliyunIThumbnailFetcher.OnThumbnailCompletion callback)` Number of incoming requests, divided evenly by time, returned thumbnails
    `int` | `requestThumbnailImage(long[] time, AliyunIThumbnailFetcher.OnThumbnailCompletion callback)` 传入时间点获取该时间点的视频缩略图，并通过回调返回结果
    `int` | `setFastMode(boolean fastMode)` To set up fast mode, this method must be called in `requestThumbnailImage(long[], OnThumbnailCompletion)` In fast mode, the thumbnail will be produced in seconds when the GOP is less than the time interval of thumbnail request.
    `int` | `setParameters(int width, int height, AliyunIThumbnailFetcher.CropMode mode, VideoDisplayMode scaleMode, int cacheSize)` 设置输出大小，该方法必须在`requestThumbnailImage(long[], OnThumbnailCompletion)` 前面调用，否则会抛出`IllegalStateException`

- - ### Method Detail

    - #### addVideoSource

          int addVideoSource(java.lang.String path,
                             long startTimeMills,
                             long endTimeMills,
                             long overlapDurationMills)

      添加视频源
      Parameters:
        `path` - 视频路径
        `startTimeMills` - 开始时间 单位：ms
        `endTimeMills` - 结束时间 单位：ms
        `overlapDurationMills` - 转场时间 单位：ms
      Returns:
        `AliyunErrorCode.OK` - 成功 `AliyunErrorCode.ERROR_INVALID_ARGUMENTS` - 参数不合法，可能的原因：文件路径错误、无效，startTime或者endTime无效

    - #### addVideoSource

          int addVideoSource(java.lang.String path)

      Deprecated. 请使用 `addVideoSource(String, long, long, long)`
      添加视频源
      Parameters:
        `path` - 视频文件地址

    - #### addImageSource

          int addImageSource(java.lang.String path,
                             long durationMills,
                             long overlapDurationMills)

      添加图片源（图片转视频时用到）
      Parameters:
        `path` - 图片文件地址
        `durationMills` - 单位：ms
        `overlapDurationMills` - 单位：ms
      Returns:
        `AliyunErrorCode.OK` - 成功

    - #### fromConfigJson

          int fromConfigJson(java.lang.String jsonPath)

      从配置文件加载视频信息（适用于SDK内操作产生的project.json）
      Parameters:
        `jsonPath` - 配置文件地址
      Returns:
        `AliyunErrorCode.OK` - 成功 `AliyunErrorCode.ERROR_INVALID_ARGUMENTS` - 参数不合法，可能的原因：json文件路径为空或者json文件无效/json文件中的视频或者图片路径错误、无效，startTime或者endTime无效

    - #### setParameters

          int setParameters(int width,
                            int height,
                            AliyunIThumbnailFetcher.CropMode mode,
                            VideoDisplayMode scaleMode,
                            int cacheSize)

      设置输出大小，该方法必须在`requestThumbnailImage(long[], OnThumbnailCompletion)` 前面调用，否则会抛出`IllegalStateException`
      Parameters:
        `width` - 输出图像宽度
        `height` - 输出图像高度
        `mode` - 图像裁剪方式 `AliyunIThumbnailFetcher.CropMode`
        `scaleMode` - 图像填充方式 `VideoDisplayMode`
        `cacheSize` - 缓存大小
      Returns:
        成功返回0，失败返回ErrorCode

    - #### requestThumbnailImage

          int requestThumbnailImage(long[] time,
                                    AliyunIThumbnailFetcher.OnThumbnailCompletion callback)

      传入时间点获取该时间点的视频缩略图，并通过回调返回结果
      Parameters:
        `time` - 一组时间点，单位毫秒，如果 `setFastMode(boolean)`设置的是true，则返回的缩略图是该时间点之前的关键帧。如果需要该时间点的精确帧， 则 `setFastMode(boolean)` 设置为 false
        `callback` - 获取缩略图结果的回调
      Returns:
        返回该次请求的ID

    - #### requestThumbnailImage

          int requestThumbnailImage(int count,
                                    AliyunIThumbnailFetcher.OnThumbnailCompletion callback)

      Number of incoming requests, divided evenly by time, returned thumbnails
      Parameters:
        `count` - Number of incoming requests
        `callback` - The callback that outputs the results.
      Returns:
        The id of this request.

    - #### setFastMode

          int setFastMode(boolean fastMode)

      To set up fast mode, this method must be called in `requestThumbnailImage(long[], OnThumbnailCompletion)` In fast mode, the thumbnail will be produced in seconds when the GOP is less than the time interval of thumbnail request.
      Parameters:
        `fastMode` - Whether fast mode, true Fast mode, solve the key frame; False Indicates the non-fast mode, which is more accurate,default is false.
      Returns:
        0 if the invocation is successful or an ErrorCode if the invocation fails.

    - #### release

          void release()

      释放资源

    - #### getTotalDuration

          long getTotalDuration()

      获取总时长，该接口必须在`addVideoSource(String, long, long, long)`之后调用
      Returns:
        总时长（时间单位：ms）