fix(player): 收敛播放入口缓冲提示

This commit is contained in:
Zhou Weidong committed 2026-10-22 10:47:16 +08:00
1 parent f302b396b7
commit 7ad4681049
12 files changed
+218 -42

No files matched your search

+1 -1
View File
@@ -677,7 +677,7 @@ class PlayerLogic extends ChangeNotifier {
}
final saved = resumePositionFor(episode.id);
if (saved != null) {
await player.controller.seekTo(
await player.seekTo(
clampResumePosition(saved, player.controller.value.duration),
);
}
-11
View File
@@ -442,17 +442,6 @@ class _PlayerPageState extends State<PlayerPage>
),
),
),
if (selected && logic.session.loading)
const Center(
child: SizedBox.square(
dimension: _playerLoadingSize,
child: CircularProgressIndicator(
key: Key('player-session-loading'),
color: AppColors.blue,
strokeWidth: _playerLoadingStrokeWidth,
),
),
),
if (selected && !ready && logic.session.error != null)
Center(
child: Padding(
@@ -79,18 +79,16 @@ class _FeedProgressBarState extends State<_FeedProgressBar> {
final width = constraints.maxWidth;
final source = widget.controller;
final scrubbing = _preview != null;
final loading =
!widget.locked &&
(source == null ||
(!scrubbing && (!source.value.isInitialized || _buffering)));
final loading = !widget.locked && !scrubbing && _buffering;
final track = widget.locked
? _inactiveTrack()
: source == null
? _loadingTrack()
? _inactiveTrack()
: ValueListenableBuilder<VideoPlayerValue>(
valueListenable: source,
builder: (context, value, _) {
if (!scrubbing && (!value.isInitialized || _buffering)) {
if (!value.isInitialized) return _inactiveTrack();
if (!scrubbing && _buffering) {
return _loadingTrack();
}
final total = value.duration.inMilliseconds;
@@ -102,7 +100,10 @@ class _FeedProgressBarState extends State<_FeedProgressBar> {
return _track(_preview ?? played, width);
},
);
final interactive = !widget.locked && !loading;
final interactive =
!widget.locked &&
!loading &&
(source?.value.isInitialized ?? false);
return GestureDetector(
key: const Key('home-feed-progress'),
behavior: HitTestBehavior.opaque,
@@ -148,7 +149,7 @@ class _FeedProgressBarState extends State<_FeedProgressBar> {
if (!value.isInitialized) {
_bufferTimer?.cancel();
_bufferTimer = null;
_setBuffering(true, notify: notify);
_setBuffering(false, notify: notify);
return;
}
if (!value.isBuffering) {
@@ -114,7 +114,7 @@ class _SeekProgressBarState extends State<SeekProgressBar> {
if (!value.isInitialized) {
_bufferTimer?.cancel();
_bufferTimer = null;
_setBuffering(true, notify: notify);
_setBuffering(false, notify: notify);
return;
}
if (!value.isBuffering) {
@@ -181,8 +181,7 @@ class _SeekProgressBarState extends State<SeekProgressBar> {
Widget _buildTrack(BuildContext context, VideoPlayerValue video) {
final total = video.duration.inMilliseconds;
final scrubbing = _previewFraction.value != null;
final loading =
!widget.locked && !scrubbing && (!video.isInitialized || _buffering);
final loading = !widget.locked && !scrubbing && _buffering;
final enabled =
!widget.locked &&
video.isInitialized &&
@@ -223,7 +222,7 @@ class _SeekProgressBarState extends State<SeekProgressBar> {
),
SizedBox(
height: trackAreaHeight,
child: widget.locked
child: widget.locked || !video.isInitialized
? _inactiveTrack(trackHeight)
: loading
? Center(