Flutter 颤振持续时间范围视频播放器

Flutter 颤振持续时间范围视频播放器,flutter,Flutter,我正在使用video\u player软件包来显示我的视频,现在我想为我的视频设置开始和结束位置,我该怎么做?seekTo是您想要的: _controller.seekTo(持续时间(秒:10)) 从源代码: /// Sets the video's current timestamp to be at [moment]. The next /// time the video is played it will resume from the given [moment]. ///

我正在使用
video\u player
软件包来显示我的视频,现在我想为我的视频设置开始和结束位置,我该怎么做?

seekTo是您想要的:

_controller.seekTo(持续时间(秒:10))

从源代码:

  /// Sets the video's current timestamp to be at [moment]. The next
  /// time the video is played it will resume from the given [moment].
  ///
  /// If [moment] is outside of the video's full range it will be automatically
  /// and silently clamped.
  Future<void> seekTo(Duration position) async {
    if (_isDisposed) {
      return;
    }
    if (position > value.duration) {
      position = value.duration;
    } else if (position < const Duration()) {
      position = const Duration();
    }
    await _videoPlayerPlatform.seekTo(_textureId, position);
    _updatePosition(position);
  }

seekTo()
设置视频的开始位置,但我想要设置开始和结束位置您是下载视频还是它是应用程序的一部分?你只想下载一部分还是只想加载一部分?不,不是关于下载,例如,我有15秒的视频,我只想播放3秒到7秒的视频。好吧,用我给你的,你可以实现你想要的,不是吗?如果您只想加载资产的一部分,我认为不可能查看AssetBundle。另一种解决方案是使用flatter_ffmpeg,从而创建新的较短视频,然后加载视频。这取决于你的需要。
Future.delayed(Duration(milliseconds: 500), () {
  setState(() {
    _controller.pause();
  });
});