Merge branch 'fix'

This commit is contained in:
guozhigq
2024-06-01 12:55:59 +08:00
2 changed files with 23 additions and 7 deletions

View File

@ -99,7 +99,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
fullScreenStatusListener();
if (Platform.isAndroid) {
floating = vdCtr.floating!;
autoEnterPip();
}
WidgetsBinding.instance.addObserver(this);
lifecycleListener();
@ -128,8 +127,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
}
// 播放器状态监听
void playerListener(PlayerStatus? status) async {
playerStatus.value = status!;
void playerListener(PlayerStatus status) async {
playerStatus.value = status;
autoEnterPip(status: status);
if (status == PlayerStatus.completed) {
// 结束播放退出全屏
if (autoExitFullcreen) {
@ -181,6 +181,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
plPlayerController!.addStatusLister(playerListener);
vdCtr.autoPlay.value = true;
vdCtr.isShowCover.value = false;
autoEnterPip(status: PlayerStatus.playing);
}
void fullScreenStatusListener() {
@ -287,10 +288,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
.subscribe(this, ModalRoute.of(context)! as PageRoute);
}
void autoEnterPip() {
void autoEnterPip({PlayerStatus? status}) {
final String routePath = Get.currentRoute;
if (autoPiP && routePath.startsWith('/video')) {
floating.toggleAutoPip(autoEnter: autoPiP);
floating.toggleAutoPip(
autoEnter: autoPiP && status == PlayerStatus.playing,
);
}
}
@ -314,6 +317,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
case 'show' || 'restart':
plPlayerController?.danmakuController?.clear();
break;
case 'pause':
vdCtr.hiddenReplyReplyPanel();
if (vdCtr.videoType == SearchType.video) {
videoIntroController.hiddenEpisodeBottomSheet();
}
if (vdCtr.videoType == SearchType.media_bangumi) {
bangumiIntroController.hiddenEpisodeBottomSheet();
}
break;
}
}

View File

@ -733,14 +733,18 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
const double threshold = 7.0; // 滑动阈值
final bool flag =
fullScreenGestureMode != FullScreenGestureMode.values.last;
if (dy > _distance.value && dy > threshold) {
if (dy > _distance.value &&
dy > threshold &&
!_.controlsLock.value) {
if (_.isFullScreen.value ^ flag) {
lastFullScreenToggleTime = DateTime.now();
// 下滑退出全屏
await widget.controller.triggerFullScreen(status: flag);
}
_distance.value = 0.0;
} else if (dy < _distance.value && dy < -threshold) {
} else if (dy < _distance.value &&
dy < -threshold &&
!_.controlsLock.value) {
if (!_.isFullScreen.value ^ flag) {
lastFullScreenToggleTime = DateTime.now();
// 上滑进入全屏