fix(player): 修复切换频道时复用已释放的视频控制器
This commit is contained in:
1 parent
45a53180d9
commit
f3ec12e3c3
6 files changed
+229
-6
No files matched your search
@@ -40,13 +40,16 @@ class PlayerLogic extends ChangeNotifier {
|
||||
required this.pictureInPicture,
|
||||
this.wallet,
|
||||
this.downloads,
|
||||
});
|
||||
Future<void> Function()? waitForFrame,
|
||||
}) : _waitForFrame =
|
||||
waitForFrame ?? (() => WidgetsBinding.instance.endOfFrame);
|
||||
|
||||
final WatchHistoryRepository history;
|
||||
final PlaybackRepository playback;
|
||||
final AndroidPictureInPicture pictureInPicture;
|
||||
final WalletController? wallet;
|
||||
final DownloadController? downloads;
|
||||
final Future<void> Function() _waitForFrame;
|
||||
|
||||
late PageController pages;
|
||||
late PlaybackQueue queue;
|
||||
@@ -220,6 +223,7 @@ class PlayerLogic extends ChangeNotifier {
|
||||
prepare: preparePlayer,
|
||||
activate: activatePlayer,
|
||||
coordinator: coordinator,
|
||||
waitForFrame: _waitForFrame,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -307,6 +311,8 @@ class PlayerLogic extends ChangeNotifier {
|
||||
session = nextSession;
|
||||
nextSession.setRouteVisible(active && visibleIndices.isNotEmpty);
|
||||
_notifyAfterFrameIfNeeded();
|
||||
await _waitForFrame();
|
||||
if (revision != feedRevision || !identical(session, nextSession)) return;
|
||||
await previous.close();
|
||||
if (revision != feedRevision || !identical(session, nextSession)) return;
|
||||
_jumpToFeedPage(targetIndex);
|
||||
|
||||
Reference in new issue
Block a user