seek method
跳转播放位置
直播与受限场景下禁用 Seek:作为全部 Seek 请求的命令层唯一消费点, 对外部与自定义 UI 的直接调用统一拦截;起播起始时间走 prepare 路径, 不经过本方法,不受拦截影响。
Seek to a specific position in the video.
Seeking is disabled in live and restricted scenes. As the single command-level entry for all seek requests, direct calls from external or custom UI are intercepted here. The start time for playback goes through the prepare path and is not affected.
position The target playback position.
Implementation
void seek(Duration position) {
// 场景门卫:live/restricted 场景记日志并直接返回,不更新进度、不下发 seekTo
// Scene gate: log and return in live/restricted scenes without seekTo.
if (_isSeekDisabledScene()) {
logi(
'Seek blocked in ${sceneTypeNotifier.value.name} scene',
tag: _logTag,
);
return;
}
currentPositionNotifier.value = position;
_aliPlayer.seekTo(
position.inMilliseconds,
_widgetData?.seekMode ?? FlutterAvpdef.ACCURATE,
);
}