fix: 将自动全屏逻辑调整到播放页,避免未开自动播放时无效果

This commit is contained in:
orz12
2024-03-02 15:14:37 +08:00
parent 0d46ebb7a3
commit 77e495ed02
4 changed files with 22 additions and 12 deletions

View File

@@ -239,7 +239,6 @@ class VideoDetailController extends GetxController
bvid: bvid,
cid: cid.value,
enableHeart: enableHeart,
isFirstTime: isFirstTime,
autoplay: autoplay,
);

View File

@@ -102,6 +102,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
plPlayerController = videoDetailController.plPlayerController;
plPlayerController!.addStatusLister(playerListener);
listenFullScreenStatus();
autoEnterFullscreen();
}
}
void autoEnterFullscreen() async {
bool autoEnterFullscreen =
setting.get(SettingBoxKey.enableAutoEnter, defaultValue: false);
if (autoEnterFullscreen && videoDetailController.isFirstTime) {
await Future.delayed(const Duration(milliseconds: 100));
plPlayerController!.triggerFullScreen(status: true);
}
}
@@ -158,6 +168,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
plPlayerController = videoDetailController.plPlayerController;
plPlayerController!.addStatusLister(playerListener);
listenFullScreenStatus();
autoEnterFullscreen();
videoDetailController.autoPlay.value = true;
videoDetailController.isShowCover.value = false;
}
@@ -195,7 +206,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
});
if (!status) {
showStatusBar();
if (setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
if (horizontalScreen) {
autoScreen();
} else {
verticalScreen();