fix(player): 播放页改为非阻塞加载
This commit is contained in:
1 parent
e8f192ccf8
commit
ee4e573f4f
7 files changed
+239
-455
No files matched your search
@@ -32,7 +32,6 @@ import '../discover/search_page.dart';
|
||||
import '../drama_detail/drama_detail_view.dart';
|
||||
import '../mine/mine_types.dart';
|
||||
import '../mine/mine_view.dart';
|
||||
import 'player_frame_capture.dart';
|
||||
import 'player_view.dart';
|
||||
import 'widgets/drama_comments_sheet.dart';
|
||||
import 'widgets/episode_picker_sheet.dart';
|
||||
@@ -65,9 +64,6 @@ class PlayerLogic extends ChangeNotifier {
|
||||
final Future<void> Function() _waitForFrame;
|
||||
|
||||
late PageController pages;
|
||||
final GlobalKey renderBoundaryKey = GlobalKey(
|
||||
debugLabel: 'player-render-boundary',
|
||||
);
|
||||
late PlaybackQueue queue;
|
||||
late List<int> visibleIndices;
|
||||
late PlaybackSession session;
|
||||
@@ -1229,18 +1225,6 @@ class PlayerLogic extends ChangeNotifier {
|
||||
Drama drama,
|
||||
int index,
|
||||
) async {
|
||||
final fallbackPosterUrl = index >= 0 && index < drama.episodes.length
|
||||
? drama.episodes[index].posterUrl
|
||||
: null;
|
||||
final preparedFrame = await PlayerFrameCapture.captureAndPrecache(
|
||||
context: context,
|
||||
boundaryKey: renderBoundaryKey,
|
||||
source: 'watch-all',
|
||||
fallbackPosterUrl: fallbackPosterUrl,
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
await pauseForFullPlayer();
|
||||
if (!context.mounted) return;
|
||||
final route = Navigator.of(context).push(
|
||||
FadePageRoute<void>(
|
||||
transitionDuration: Duration.zero,
|
||||
@@ -1250,15 +1234,13 @@ class PlayerLogic extends ChangeNotifier {
|
||||
initialIndex: index,
|
||||
wallet: wallet,
|
||||
downloads: downloads,
|
||||
revealAfterFirstFrame: preparedFrame.isReady,
|
||||
initialFrameBytes: preparedFrame.bytes,
|
||||
initialFrameProvider: preparedFrame.provider,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (kDebugMode) {
|
||||
debugPrint('[player-entry] phase=route-pushed source=watch-all ms=0');
|
||||
}
|
||||
unawaited(pauseForFullPlayer());
|
||||
unawaited(saveCurrentProgress());
|
||||
await route;
|
||||
if (!isMounted()) return;
|
||||
|
||||
Reference in new issue
Block a user