fix(player): 优化封面过渡与换集起播

This commit is contained in:
Zhou Weidong committed 2026-10-26 14:01:42 +08:00
1 parent 516593499c
commit 04f034817c
6 files changed
+65 -19

No files matched your search

+2 -3
View File
@@ -41,7 +41,6 @@ class PlaybackSession extends ChangeNotifier {
final Future<void> Function()? waitForFrame;
final PlaybackCoordinator _coordinator;
final Set<_PlayerSlot> _live = {};
final Set<String> _pausedEpisodeIds = {};
_PlayerSlot? _active;
_PlayerSlot? _next;
_PlayerSlot? _previous;
@@ -207,9 +206,9 @@ class PlaybackSession extends ChangeNotifier {
int? previousIndex,
}) async {
if (_closed || index < 0 || index >= episodes.length) return;
// 新集默认起播;用户手动暂停过的同一集滑回时继续尊重暂停。
// 切换到不同剧集时恢复播放;仍停留在同一集时保留用户暂停。
if (!_selected || index != _currentIndex) {
_userWantsPlay = !_pausedEpisodeIds.contains(episodes[index].id);
_userWantsPlay = true;
}
final request = ++_generation;
_selected = true;
@@ -37,16 +37,8 @@ extension PlaybackSessionControls on PlaybackSession {
_syncPlayback();
}
/// 记录用户播放意图;手动暂停的剧集滑回时不再自动起播。
/// 记录用户播放意图;切换剧集时会在 [PlaybackSession.select] 中恢复播放。
void setUserWantsPlay(bool value) {
if (episodes.isNotEmpty) {
final episodeId = episodes[_currentIndex].id;
if (value) {
_pausedEpisodeIds.remove(episodeId);
} else {
_pausedEpisodeIds.add(episodeId);
}
}
_userWantsPlay = value;
_syncPlayback();
_notify();