exportImagesFromFile static method

Stream<File> exportImagesFromFile(
  1. File file,
  2. Duration interval,
  3. double radian
)

Returns Stream of images from video file

  • parameters:
    • file: file of video
    • interval: the time interval between each frame
    • radian: rotation the frame ,which will export frame.Rotation is clockwise.

Implementation

static Stream<File> exportImagesFromFile(
    File file, Duration interval, double radian) async* {
  var mediaInfo = MediaInfo();
  var videoInfo = await mediaInfo.getMediaInfo(file.path);

  var videoLength = Duration(milliseconds: videoInfo["durationMs"]);

  workOnImages = true;
  for (var i = Duration.zero; i < videoLength; i += interval) {
    var image = await exportImageBySeconds(file, i, radian);
    if (stopWoringOnImages) {
      break;
    } else {
      yield image;
    }
  }
  stopWoringOnImages = false;
  workOnImages = false;
}