From fab34df9730ad4b05a84286fcde7744d8806f276 Mon Sep 17 00:00:00 2001 From: dom Date: Sat, 9 May 2026 18:11:57 +0800 Subject: [PATCH] tweaks Signed-off-by: dom --- lib/pages/live_room/view.dart | 14 +++++------ lib/pages/video/controller.dart | 5 +++- lib/plugin/pl_player/controller.dart | 1 - lib/plugin/pl_player/view/view.dart | 37 ++++++++++++++-------------- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index 5567b7d5e..69bf88b32 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -115,9 +115,12 @@ class _LiveRoomPageState extends State @override Future didPopNext() async { addObserverMobile(this); - plPlayerController - ..isLive = true - ..danmakuController = _liveRoomController.danmakuController; + if (!plPlayerController.isLive) { + plPlayerController.isLive = true; + _liveRoomController.isLoaded.refresh(); + } + plPlayerController.danmakuController = + _liveRoomController.danmakuController; PlPlayerController.setPlayCallBack(plPlayerController.play); _liveRoomController.startLiveTimer(); if (plPlayerController.playerStatus.isPlaying && @@ -242,9 +245,6 @@ class _LiveRoomPageState extends State Alignment alignment = Alignment.center, bool needDm = true, }) { - if (!plPlayerController.isLive) { - return const SizedBox.shrink(); - } if (!isFullScreen && !plPlayerController.isDesktopPip) { _liveRoomController.fsSC.value = null; } @@ -252,7 +252,7 @@ class _LiveRoomPageState extends State Widget player = Obx( key: playerKey, () { - if (_liveRoomController.isLoaded.value) { + if (_liveRoomController.isLoaded.value && plPlayerController.isLive) { final roomInfoH5 = _liveRoomController.roomInfoH5.value; return PLVideoPlayer( maxWidth: width, diff --git a/lib/pages/video/controller.dart b/lib/pages/video/controller.dart index 5dc2e6dea..de8ecbf2d 100644 --- a/lib/pages/video/controller.dart +++ b/lib/pages/video/controller.dart @@ -267,7 +267,10 @@ class VideoDetailController extends GetxController final isVertical = height > width; if (_scrollCtr?.hasClients != true) { videoHeight = isVertical ? maxVideoHeight : minVideoHeight; - this.isVertical.value = isVertical; + if (this.isVertical.value != isVertical) { + this.isVertical.value = isVertical; + _needAnimOnDimensionChanged(isVertical); + } return; } if (this.isVertical.value != isVertical) { diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 552396641..d999691c8 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -362,7 +362,6 @@ class PlPlayerController with BlockConfigMixin { late final keyboardControl = Pref.keyboardControl; late final uiScale = Pref.uiScale; - late final bool autoEnterFullScreen = Pref.autoEnterFullScreen; late final bool autoExitFullscreen = Pref.autoExitFullscreen; late final bool autoPlayEnable = Pref.autoPlayEnable; diff --git a/lib/plugin/pl_player/view/view.dart b/lib/plugin/pl_player/view/view.dart index 3ebf82cb0..8ad5f3e1d 100644 --- a/lib/plugin/pl_player/view/view.dart +++ b/lib/plugin/pl_player/view/view.dart @@ -1211,7 +1211,7 @@ class _PLVideoPlayerState extends State StreamSubscription? _danmakuListener; - static const _kOffsetThreshold = 40.0; + static const _kOffsetThreshold = 30.0; bool _isPositionAllowed(Offset offset) { if (offset.dx < _kOffsetThreshold || offset.dy < _kOffsetThreshold || @@ -1241,29 +1241,30 @@ class _PLVideoPlayerState extends State } } - if (_isPositionAllowed(event.localPosition)) { - final controlsUnlock = !plPlayerController.controlsLock.value; - if (PlatformUtils.isMobile) { - _tapGestureRecognizer.addPointer(event); - if (controlsUnlock) { - if (!plPlayerController.isLive) { - _doubleTapGestureRecognizer.addPointer(event); - longPressRecognizer.addPointer(event); - } - _scaleGestureRecognizer.addPointer(event); - } - } else { - if (controlsUnlock) { - if (!plPlayerController.isLive) { - _tapGestureRecognizer.addPointer(event); - } + final controlsUnlock = !plPlayerController.controlsLock.value; + if (PlatformUtils.isMobile) { + _tapGestureRecognizer.addPointer(event); + if (controlsUnlock) { + final flag = _isPositionAllowed(event.localPosition); + if (!plPlayerController.isLive) { _doubleTapGestureRecognizer.addPointer(event); - if (!plPlayerController.isLive) { + if (flag) { longPressRecognizer.addPointer(event); } + } + if (flag) { _scaleGestureRecognizer.addPointer(event); } } + } else if (controlsUnlock) { + if (plPlayerController.isLive) { + _doubleTapGestureRecognizer.addPointer(event); + } else { + _tapGestureRecognizer.addPointer(event); + _doubleTapGestureRecognizer.addPointer(event); + longPressRecognizer.addPointer(event); + } + _scaleGestureRecognizer.addPointer(event); } }