fix(player): 使用雪碧图预热首帧兜底
This commit is contained in:
1 parent
48b4e67d34
commit
70d8e0f982
13 files changed
+207
-322
No files matched your search
@@ -249,9 +249,7 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('should_show_frame_card_with_cover_then_hide_on_release', (
|
||||
tester,
|
||||
) async {
|
||||
testWidgets('should_show_frame_card_then_hide_on_release', (tester) async {
|
||||
final video = ValueNotifier<VideoPlayerValue>(
|
||||
const VideoPlayerValue(
|
||||
duration: Duration(seconds: 12),
|
||||
@@ -272,7 +270,6 @@ void main() {
|
||||
valueListenable: video,
|
||||
semanticsLabel: 'Seek video',
|
||||
episodeId: 'episode-1',
|
||||
posterUrl: '',
|
||||
thumbnailService: service,
|
||||
onSeek: (_) async {},
|
||||
),
|
||||
@@ -289,7 +286,7 @@ void main() {
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byKey(const Key('scrub-preview-card')), findsOneWidget);
|
||||
expect(find.byKey(const Key('scrub-preview-poster')), findsOneWidget);
|
||||
expect(find.byKey(const Key('scrub-preview-background')), findsOneWidget);
|
||||
expect(find.byKey(const Key('scrub-preview-frame')), findsNothing);
|
||||
expect(find.textContaining('/ 00:12'), findsOneWidget);
|
||||
expect(
|
||||
|
||||
@@ -114,6 +114,32 @@ void main() {
|
||||
expect(service.hasAxis('https://cdn.test/thumbnails.vtt'), isTrue);
|
||||
});
|
||||
|
||||
testWidgets('should_keep_zero_frames_ready_across_neighbor_episodes', (
|
||||
tester,
|
||||
) async {
|
||||
final loader = _FakeSpriteLoader(vtt: _spriteVtt);
|
||||
final service = SpriteThumbnailAxisService(
|
||||
loader: loader,
|
||||
spriteCacheCapacity: 6,
|
||||
);
|
||||
addTearDown(service.dispose);
|
||||
const current = 'https://cdn.test/episode-1/thumbnails.vtt';
|
||||
const previous = 'https://cdn.test/episode-0/thumbnails.vtt';
|
||||
const next = 'https://cdn.test/episode-2/thumbnails.vtt';
|
||||
|
||||
await Future.wait([
|
||||
service.prepareAt(previous, Duration.zero),
|
||||
service.prepareAt(current, Duration.zero),
|
||||
service.prepareAt(next, Duration.zero),
|
||||
]);
|
||||
|
||||
for (final url in [previous, current, next]) {
|
||||
expect(service.hasAxis(url), isTrue);
|
||||
expect(service.cachedFrameAt(url, Duration.zero), isNotNull);
|
||||
}
|
||||
expect(loader.spriteCalls, hasLength(6));
|
||||
});
|
||||
|
||||
testWidgets('should_refresh_vtt_after_ten_minute_ttl', (tester) async {
|
||||
var now = DateTime(2026, 10, 22);
|
||||
final loader = _FakeSpriteLoader(vtt: _spriteVtt);
|
||||
|
||||
Reference in new issue
Block a user