fix(player): 路由覆盖时暂停播放

This commit is contained in:
Zhou Weidong committed 2026-10-20 19:24:49 +08:00
1 parent 911f13f464
commit 699fd427b8
5 files changed
+141 -2

No files matched your search

+14
View File
@@ -289,6 +289,20 @@ class PlayerLogic extends ChangeNotifier {
}
}
/// 当前播放器页面被其它 PageRoute 覆盖时暂停并保存进度。
void onRouteCovered() {
if (!_started) return;
session.setRouteVisible(false);
cancelScrub();
unawaited(saveCurrentProgress());
}
/// 覆盖播放器的 PageRoute 返回后恢复当前 Tab 的播放状态。
void onRouteRevealed() {
if (!_started || !isMounted()) return;
session.setRouteVisible(active);
}
void onPageUpdated(PlayerPage previous) {
if (previous.active != active) {
session.setRouteVisible(active && visibleIndices.isNotEmpty);