fix(player): 修正封面比例与首帧切换闪烁

This commit is contained in:
Zhou Weidong committed 2026-10-26 14:07:36 +08:00
1 parent 04f034817c
commit a3a79f7068
5 files changed
+148 -7

No files matched your search

@@ -55,9 +55,23 @@ void main() {
final controller = await _pumpSurface(
tester,
openingFrame: const ColoredBox(color: Colors.red),
holdOpeningUntilFirstFrame: true,
);
expect(_opacity(tester), 0);
controller.value = const VideoPlayerValue(
duration: Duration(minutes: 1),
size: Size(1280, 720),
position: Duration.zero,
isInitialized: true,
isPlaying: true,
);
await tester.pump();
expect(_opacity(tester), 0);
expect(_openingOpacity(tester), 1);
expect(find.byKey(const Key('player-opening-frame')), findsOneWidget);
controller.value = const VideoPlayerValue(
duration: Duration(minutes: 1),
size: Size(1280, 720),
@@ -153,6 +167,7 @@ Future<VideoPlayerController> _pumpSurface(
WidgetTester tester, {
VideoPlayerValue? value,
Widget? openingFrame,
bool holdOpeningUntilFirstFrame = false,
}) async {
final controller = VideoPlayerController.networkUrl(
Uri.parse('http://192.168.31.187:8081/files/video.mp4'),
@@ -167,6 +182,7 @@ Future<VideoPlayerController> _pumpSurface(
videoUrl: controller.dataSource,
theater: false,
openingFrame: openingFrame,
holdOpeningUntilFirstFrame: holdOpeningUntilFirstFrame,
),
),
),