fix(player): 修正缓冲态与首帧时间闪现
This commit is contained in:
1 parent
0f27daf664
commit
350d16db75
8 files changed
+262
-22
No files matched your search
@@ -361,7 +361,11 @@ void main() {
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byKey(const Key('player-progress')), findsOneWidget);
|
||||
expect(find.text('00:00 / 01:00'), findsOneWidget);
|
||||
expect(
|
||||
find.byKey(const Key('player-progress-uninitialized-time')),
|
||||
findsNothing,
|
||||
);
|
||||
expect(find.text('00:00 / 01:00'), findsNothing);
|
||||
|
||||
// IgnorePointer 让加载中的播放暂停与上下滑穿透,滑动会关闭入口 loading。
|
||||
expect(fullLogic.session.userWantsPlay, isTrue);
|
||||
@@ -515,6 +519,49 @@ void main() {
|
||||
expect(find.byKey(const Key('progress-inactive')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_only_show_progress_buffer_after_video_first_frame', (
|
||||
tester,
|
||||
) async {
|
||||
final factory = _RouteVideoFactory();
|
||||
await _pumpApp(tester, playerFactory: factory.create);
|
||||
await _openSeriesPlayer(tester);
|
||||
|
||||
final videoIndex = factory.episodes.lastIndexWhere(
|
||||
(episode) => episode.id == 'city-lights-demo-1',
|
||||
);
|
||||
final video = factory.created[videoIndex];
|
||||
expect(video.controller.value.isInitialized, isTrue);
|
||||
expect(find.byKey(const Key('player-entry-loading-overlay')), findsNothing);
|
||||
|
||||
video.controller.value = const VideoPlayerValue(
|
||||
duration: Duration(minutes: 1),
|
||||
size: Size(1280, 720),
|
||||
position: Duration(seconds: 5),
|
||||
isInitialized: true,
|
||||
isPlaying: true,
|
||||
isBuffering: true,
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
|
||||
expect(find.byKey(const Key('progress-loading')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-entry-loading-overlay')), findsNothing);
|
||||
expect(find.byKey(const Key('player-video-loading')), findsNothing);
|
||||
expect(find.byKey(const Key('player-ticket-loading')), findsNothing);
|
||||
|
||||
video.controller.value = const VideoPlayerValue(
|
||||
duration: Duration(minutes: 1),
|
||||
size: Size(1280, 720),
|
||||
position: Duration(seconds: 6),
|
||||
isInitialized: true,
|
||||
isPlaying: true,
|
||||
isBuffering: true,
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byKey(const Key('progress-loading')), findsNothing);
|
||||
expect(find.byType(Slider), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_pause_feed_when_auth_page_is_pushed_and_resume_on_pop', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in new issue
Block a user