fix(player): 分离首页与播放页播放上下文

This commit is contained in:
Zhou Weidong committed 2026-10-26 16:37:37 +08:00
1 parent 440188f261
commit 6667330ce0
8 files changed
+312 -362

No files matched your search

+27
View File
@@ -32,6 +32,33 @@ void main() {
await session.close();
});
test('should_keep_only_current_player_when_neighbor_warmup_disabled', () async {
final factory = FakeFactory();
final session = PlaybackSession(
episodes: episodes,
factory: factory.create,
canPlay: (episode) => episode.isFree,
warmNeighborsEnabled: false,
);
await session.select(0, preloadIndex: 1);
await session.preloadSettled;
expect(factory.created, hasLength(1));
expect(factory.live, 1);
expect(session.preloadedIndex, isNull);
final first = factory.created.single;
await session.select(1, preloadIndex: 2, previousIndex: 0);
await session.preloadSettled;
expect(first.disposed, isTrue);
expect(factory.created, hasLength(2));
expect(factory.live, 1);
expect(session.livePlayerCount, 1);
expect(session.active, same(factory.created.last));
await session.close();
});
test('should_release_previous_player_immediately_when_selecting_locked', () async {
final lockedEpisodes = [
Episode(