fix(player): 观看全集进入后自动播放

This commit is contained in:
Zhou Weidong committed 2026-10-26 21:25:38 +08:00
1 parent 350d16db75
commit 37353dac15
5 files changed
+126 -6

No files matched your search

+2
View File
@@ -249,6 +249,8 @@ class PlayerLogic extends ChangeNotifier {
'[feed-session] phase=$phase session=${identityHashCode(session)} '
'index=${session.currentIndex} episode=${session.currentEpisode.id} '
'controller=${video == null ? '-' : identityHashCode(video.controller)} '
'user=${session.userWantsPlay} routeVisible=${session.debugRouteVisible} '
'appResumed=${session.debugAppResumed} overlayOpen=${session.debugOverlayOpen} '
'live=${session.livePlayerCount}',
);
}
+30 -3
View File
@@ -148,6 +148,7 @@ class _PlayerPageState extends State<PlayerPage>
bool _loadingRemoved = true;
bool _loadingFadeScheduled = false;
bool _loggedLoadingUiVisible = false;
bool _loggedStartConditions = false;
final PlayerHeartOverlayController _heartOverlayController =
PlayerHeartOverlayController();
final Set<String> _precachedPosterUrls = {};
@@ -160,6 +161,7 @@ class _PlayerPageState extends State<PlayerPage>
void initState() {
super.initState();
final handoff = widget.handoff;
final initialUserWantsPlay = handoff?.sourceUserWantsPlay ?? true;
logic = PlayerBinding().create(
history: context.read<WatchHistoryRepository>(),
playback: context.read<PlaybackRepository>(),
@@ -179,8 +181,21 @@ class _PlayerPageState extends State<PlayerPage>
coordinator: widget.embedded
? context.read<PlaybackCoordinator>()
: PlaybackCoordinator(),
initialUserWantsPlay: handoff?.sourceUserWantsPlay ?? true,
initialUserWantsPlay: initialUserWantsPlay,
);
if (kDebugMode) {
debugPrint(
'[player-start] phase=initialized '
'session=${identityHashCode(logic.session)} '
'initialUserWantsPlay=$initialUserWantsPlay '
'sessionUserWantsPlay=${logic.session.userWantsPlay} '
'active=${logic.active} embedded=${widget.embedded} '
'appResumed=${logic.session.debugAppResumed} '
'routeVisible=${logic.session.debugRouteVisible} '
'overlayOpen=${logic.session.debugOverlayOpen} '
'live=${logic.session.livePlayerCount}',
);
}
_pageController = logic.pages;
if (!widget.embedded &&
!logic.isEpisodeLocked(logic.session.currentEpisode)) {
@@ -575,6 +590,19 @@ class _PlayerPageState extends State<PlayerPage>
Widget _buildPlayer(BuildContext context) {
final interactions = context.watch<InteractionController>();
final l10n = AppLocalizations.of(context)!;
if (kDebugMode && !_loggedStartConditions) {
_loggedStartConditions = true;
debugPrint(
'[player-start] phase=first-build '
'session=${identityHashCode(logic.session)} '
'tickerMode=${TickerMode.valuesOf(context).enabled} '
'routeVisible=${logic.session.debugRouteVisible} '
'appResumed=${logic.session.debugAppResumed} '
'overlayOpen=${logic.session.debugOverlayOpen} '
'visible=${logic.session.debugVisible} '
'mayPlay=${logic.session.debugMayPlay}',
);
}
final indices = logic.visibleIndices;
final activePort = logic.session.active;
final activeVideo = activePort is VideoPlayerPort ? activePort : null;
@@ -1341,8 +1369,7 @@ class _PlayerPageState extends State<PlayerPage>
seriesEpisodes.insert(0, sourceEpisode);
episodeIndex = 0;
}
final sourceUserWantsPlay = logic.session.userWantsPlay;
final handoff = PlayerPageHandoff(sourceUserWantsPlay: sourceUserWantsPlay);
final handoff = PlayerPageHandoff(sourceUserWantsPlay: true);
_logFullPlayerRoute('present');
setState(() => _presentationActive = true);
final route = Navigator.of(context).push<void>(