diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 3b988330..820c9f6b 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -181,7 +181,7 @@ class _LiveRoomPageState extends State { } if (MediaQuery.of(context).orientation == Orientation.landscape) { - verticalScreen(); + verticalScreenForTwoSeconds(); } }, child: SizedBox( diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 2a83061e..bbc41b4a 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -200,20 +200,20 @@ class _VideoDetailPageState extends State plPlayerController!.isFullScreen.listen((bool status) { if (status) { videoDetailController.hiddenReplyReplyPanel(); - hideStatusBar(); + // hideStatusBar(); } isFullScreen.value = status; if (mounted) { setState(() {}); } - if (!status) { - showStatusBar(); - if (horizontalScreen) { - autoScreen(); - } else { - verticalScreen(); - } - } + // if (!status) { + // showStatusBar(); + // if (horizontalScreen) { + // autoScreen(); + // } else { + // verticalScreenForTwoSeconds(); + // } + // } }); } @@ -371,7 +371,7 @@ class _VideoDetailPageState extends State if (MediaQuery.of(context).orientation == Orientation.landscape && !horizontalScreen) { - verticalScreen(); + verticalScreenForTwoSeconds(); } }, child: Stack( @@ -623,7 +623,7 @@ class _VideoDetailPageState extends State if (MediaQuery.of(context).orientation == Orientation.landscape && !horizontalScreen) { - verticalScreen(); + verticalScreenForTwoSeconds(); } }, child: Stack( diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index 3b29c74e..f5d78caf 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -1052,7 +1052,7 @@ class _HeaderControlState extends State { Orientation.landscape && !horizontalScreen) { - verticalScreen(), + verticalScreenForTwoSeconds(), }, Get.back() } diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 4a177342..090ab2a9 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -992,6 +992,8 @@ class PlPlayerController { // 全屏 Future triggerFullScreen({bool status = true}) async { + FullScreenMode mode = FullScreenModeCode.fromCode( + setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!; if (!isFullScreen.value && status) { // StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE); hideStatusBar(); @@ -1000,8 +1002,6 @@ class PlPlayerController { toggleFullScreen(true); /// 进入全屏 - FullScreenMode mode = FullScreenModeCode.fromCode( - setting.get(SettingBoxKey.fullScreenMode, defaultValue: 0))!; if (mode == FullScreenMode.none) { return; } @@ -1010,7 +1010,7 @@ class PlPlayerController { (mode == FullScreenMode.ratio && (Get.height / Get.width < 1.25 || direction.value == 'vertical'))) { - await verticalScreen(); + await verticalScreenForTwoSeconds(); } else { await landScape(); } @@ -1018,8 +1018,9 @@ class PlPlayerController { // StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE); showStatusBar(); toggleFullScreen(false); - if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) { - await verticalScreen(); + if (!setting.get(SettingBoxKey.horizontalScreen, defaultValue: false) && + mode != FullScreenMode.none) { + await verticalScreenForTwoSeconds(); } } } diff --git a/lib/plugin/pl_player/utils/fullscreen.dart b/lib/plugin/pl_player/utils/fullscreen.dart index aa7e4768..7f354c49 100644 --- a/lib/plugin/pl_player/utils/fullscreen.dart +++ b/lib/plugin/pl_player/utils/fullscreen.dart @@ -25,6 +25,16 @@ Future landScape() async { } } +//竖屏 +Future verticalScreenForTwoSeconds() async { + await SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + ]); + Future.delayed(const Duration(seconds: 2), () { + autoScreen(); + }); +} + //竖屏 Future verticalScreen() async { await SystemChrome.setPreferredOrientations([