com.aliyun.svideosdk.common

## Interface AliyunIThumbnailFetcher

-     public interface AliyunIThumbnailFetcher

  An interface that is used to obtain thumbnail images.

- - ### 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)` Adds an image source.
    `int` | `addVideoSource(java.lang.String path)` Deprecated. Replaced by `addVideoSource(String, long, long, long)`.
    `int` | `addVideoSource(java.lang.String path, long startTimeMills, long endTimeMills, long overlapDurationMills)` Adds a video source.
    `int` | `fromConfigJson(java.lang.String jsonPath)` Gets video information from a configuration file.
    `long` | `getTotalDuration()` Gets the total video duration.
    `void` | `release()` Releases resources.
    `int` | `requestThumbnailImage(int count, AliyunIThumbnailFetcher.OnThumbnailCompletion callback)`
    `int` | `requestThumbnailImage(long[] time, AliyunIThumbnailFetcher.OnThumbnailCompletion callback)` Gets thumbnail images at specific time points.
    `int` | `setFastMode(boolean fastMode)`
    `int` | `setParameters(int width, int height, AliyunIThumbnailFetcher.CropMode mode, VideoDisplayMode scaleMode, int cacheSize)` Sets output resolution.

- - ### Method Detail

    - #### addVideoSource

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

      Adds a video source.
      Parameters:
        `path` - The path of the video file.
        `startTimeMills` - The start time of the video in milliseconds.
        `endTimeMills` - The end time of the video in milliseconds.
        `overlapDurationMills` - The transition duration in milliseconds.
      Returns:
        `AliyunErrorCode.OK` if the invocation is successful. `AliyunErrorCode.ERROR_INVALID_ARGUMENTS` if invalid parameters are found, such as incorrect or invalid file path, and invalid startTime or endTime.

    - #### addVideoSource

          int addVideoSource(java.lang.String path)

      Deprecated. Replaced by `addVideoSource(String, long, long, long)`.
      Adds a video source.
      Parameters:
        `path` - The path of the video file.

    - #### addImageSource

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

      Adds an image source.
      Parameters:
        `path` - The path of the image file.
        `durationMills` - The display duration of the image in milliseconds.
        `overlapDurationMills` - The transition duration in milliseconds.
      Returns:
        `AliyunErrorCode.OK` if the invocation is successful.

    - #### fromConfigJson

          int fromConfigJson(java.lang.String jsonPath)

      Gets video information from a configuration file. This method is applicable to project.json configuration files.
      Parameters:
        `jsonPath` - The path of the configuration file.
      Returns:
        `AliyunErrorCode.OK` if the invocation is successful. `AliyunErrorCode.ERROR_INVALID_ARGUMENTS` if invalid parameters are found, such as empty JSON file path, invalid JSON file, incorrect paths of video or image files in the JSON file, and invalid startTime or endTime.

    - #### setParameters

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

      Sets output resolution. This method must be invoked before `requestThumbnailImage(long[], OnThumbnailCompletion)`. Otherwise, an `IllegalStateException` will be thrown.
      Parameters:
        `width` - The output image width.
        `height` - The output image height.
        `mode` - The image crop mode. `AliyunIThumbnailFetcher.CropMode`
        `scaleMode` - The image display mode. `VideoDisplayMode`
        `cacheSize` - The cache size.
      Returns:
        0 if the invocation is successful or an ErrorCode if the invocation fails.

    - #### requestThumbnailImage

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

      Gets thumbnail images at specific time points. Use a callback to return the results.
      Parameters:
        `time` - The time points. Unit: milliseconds. If `setFastMode(boolean)` is set to true, the thumbnail image returned is the keyframe prior to that point in time. Set `setFastMode(boolean)` to false if an exact frame of this point in time is required
        `callback` - The callback that outputs the results.
      Returns:
        The id of this request.

    - #### requestThumbnailImage

          int requestThumbnailImage(int count,
                                    AliyunIThumbnailFetcher.OnThumbnailCompletion callback)

    - #### setFastMode

          int setFastMode(boolean fastMode)

    - #### release

          void release()

      Releases resources.

    - #### getTotalDuration

          long getTotalDuration()

      Gets the total video duration. This method must be invoked after `addVideoSource(String, long, long, long)`.
      Returns:
        The total video duration in milliseconds.