feat(app): 完善播放协议搜索与空状态
This commit is contained in:
1 parent
671e0ce143
commit
ef29fc5f15
85 files changed
+2976
-768
No files matched your search
@@ -69,6 +69,51 @@ void main() {
|
||||
expect(_opacity(tester), 0);
|
||||
expect(find.byKey(const Key('player-debug-video')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('should_cover_new_video_only_while_handoff_is_held', (
|
||||
tester,
|
||||
) async {
|
||||
final current = VideoPlayerController.networkUrl(
|
||||
Uri.parse('http://192.168.31.187:8081/files/720.m3u8'),
|
||||
);
|
||||
final previous = VideoPlayerController.networkUrl(
|
||||
Uri.parse('http://192.168.31.187:8081/files/360.m3u8'),
|
||||
);
|
||||
addTearDown(current.dispose);
|
||||
addTearDown(previous.dispose);
|
||||
const ready = VideoPlayerValue(
|
||||
duration: Duration(minutes: 1),
|
||||
size: Size(1280, 720),
|
||||
position: Duration(seconds: 3),
|
||||
isInitialized: true,
|
||||
isPlaying: true,
|
||||
);
|
||||
current.value = ready;
|
||||
previous.value = ready;
|
||||
|
||||
Future<void> pump(VideoPlayerController? handoff) {
|
||||
return tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: PlayerVideoSurface(
|
||||
controller: current,
|
||||
handoff: handoff,
|
||||
videoUrl: current.dataSource,
|
||||
theater: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
await pump(previous);
|
||||
expect(find.byKey(const Key('player-video-handoff')), findsOneWidget);
|
||||
expect(_opacity(tester), 1);
|
||||
|
||||
await pump(null);
|
||||
expect(find.byKey(const Key('player-video-handoff')), findsNothing);
|
||||
expect(find.byType(VideoPlayer), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
Future<VideoPlayerController> _pumpSurface(
|
||||
|
||||
Reference in new issue
Block a user