mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 将自动全屏逻辑调整到播放页,避免未开自动播放时无效果
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPalaX/utils/storage.dart';
|
||||
import 'package:floating/floating.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -34,8 +35,17 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
|
||||
}
|
||||
videoSourceInit();
|
||||
_futureBuilderFuture = _liveRoomController.queryLiveInfo();
|
||||
autoEnterFullscreen();
|
||||
}
|
||||
|
||||
void autoEnterFullscreen() async {
|
||||
bool autoEnterFullscreen =
|
||||
GStrorage.setting.get(SettingBoxKey.enableAutoEnter, defaultValue: false);
|
||||
if (autoEnterFullscreen) {
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
plPlayerController!.triggerFullScreen(status: true);
|
||||
}
|
||||
}
|
||||
Future<void> videoSourceInit() async {
|
||||
_futureBuilder = _liveRoomController.queryLiveInfoH5();
|
||||
plPlayerController = _liveRoomController.plPlayerController;
|
||||
|
||||
@@ -239,7 +239,6 @@ class VideoDetailController extends GetxController
|
||||
bvid: bvid,
|
||||
cid: cid.value,
|
||||
enableHeart: enableHeart,
|
||||
isFirstTime: isFirstTime,
|
||||
autoplay: autoplay,
|
||||
);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user