videoItem property

MovieEntity? videoItem

Implementation

MovieEntity? get videoItem => _videoItem;
void videoItem=(MovieEntity? value)

Implementation

set videoItem(MovieEntity? value) {
  assert(!_isDisposed, '$this has been disposed!');
  if (_isDisposed) return;
  if (isAnimating) {
    stop();
  }
  if (value == null) {
    clear();
  }
  if (_videoItem != null && _videoItem!.autorelease) {
    _videoItem!.dispose();
  }
  _videoItem = value;
  if (value != null) {
    final movieParams = value.params;
    assert(
        movieParams.viewBoxWidth >= 0 &&
            movieParams.viewBoxHeight >= 0 &&
            movieParams.frames >= 1,
        "Invalid SVGA file!");
    int fps = movieParams.fps;
    // avoid dividing by 0, use 20 by default
    // see https://github.com/svga/SVGAPlayer-Web/blob/1c5711db068a25006316f9890b11d6666d531c39/src/videoEntity.js#L51
    if (fps == 0) fps = 20;
    duration =
        Duration(milliseconds: (movieParams.frames / fps * 1000).toInt());
  } else {
    duration = Duration.zero;
  }
  // reset progress after videoitem changed
  reset();
}