mod: 提前关闭封面、点击小电视强制尝试播放

This commit is contained in:
orz12
2024-06-12 18:34:07 +08:00
parent cf725e39d4
commit 2035ae90f3
4 changed files with 29 additions and 8 deletions

View File

@@ -117,6 +117,7 @@ class VideoDetailController extends GetxController
length: 2, vsync: this, initialIndex: defaultShowComment ? 1 : 0);
autoPlay.value =
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
if (autoPlay.value) isShowCover.value = false;
enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: true);
hwdec.value = setting.get(SettingBoxKey.hardwareDecoding,
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
@@ -319,8 +320,8 @@ class VideoDetailController extends GetxController
currentDecodeFormats = VideoDecodeFormatsCode.fromString('avc1')!;
currentVideoQa = VideoQualityCode.fromCode(data.quality!)!;
if (autoPlay.value) {
await playerInit();
isShowCover.value = false;
await playerInit();
}
return result;
}
@@ -421,8 +422,8 @@ class VideoDetailController extends GetxController
}
defaultST = Duration(milliseconds: data.lastPlayTime!);
if (autoPlay.value) {
await playerInit();
isShowCover.value = false;
await playerInit();
}
} else {
if (result['code'] == -404) {

View File

@@ -200,13 +200,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
/// 未开启自动播放时触发播放
Future<void> handlePlay() async {
videoDetailController.isShowCover.value = false;
await videoDetailController.playerInit();
plPlayerController = videoDetailController.plPlayerController;
plPlayerController!.addStatusLister(playerListener);
listenFullScreenStatus();
await plPlayerController!.autoEnterFullscreen();
videoDetailController.autoPlay.value = true;
videoDetailController.isShowCover.value = false;
}
// // 生命周期监听
@@ -310,11 +310,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
super.didPopNext();
videoDetailController.isFirstTime = false;
final bool autoplay = autoPlayEnable;
videoDetailController.autoPlay.value =
!videoDetailController.isShowCover.value;
await videoDetailController.playerInit(autoplay: autoplay);
/// 未开启自动播放时,未播放跳转下一页返回/播放后跳转下一页返回
videoDetailController.autoPlay.value =
!videoDetailController.isShowCover.value;
videoIntroController.isPaused = false;
// if (autoplay) {
// // await Future.delayed(const Duration(milliseconds: 300));