mod: playInit autoplay 逻辑

This commit is contained in:
guozhigq
2024-05-18 19:29:57 +08:00
parent 9c2364d7ed
commit eae39c480c
2 changed files with 4 additions and 4 deletions

View File

@ -233,7 +233,7 @@ class VideoDetailController extends GetxController
audio, audio,
seekToTime, seekToTime,
duration, duration,
bool autoplay = true, bool? autoplay,
}) async { }) async {
/// 设置/恢复 屏幕亮度 /// 设置/恢复 屏幕亮度
if (brightness != null) { if (brightness != null) {
@ -266,7 +266,7 @@ class VideoDetailController extends GetxController
cid: cid.value, cid: cid.value,
enableHeart: enableHeart, enableHeart: enableHeart,
isFirstTime: isFirstTime, isFirstTime: isFirstTime,
autoplay: autoplay, autoplay: autoplay ?? autoPlay.value,
); );
/// 开启自动全屏时在player初始化完成后立即传入headerControl /// 开启自动全屏时在player初始化完成后立即传入headerControl

View File

@ -176,7 +176,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
/// 未开启自动播放时触发播放 /// 未开启自动播放时触发播放
Future<void> handlePlay() async { Future<void> handlePlay() async {
await vdCtr.playerInit(); await vdCtr.playerInit(autoplay: true);
plPlayerController = vdCtr.plPlayerController; plPlayerController = vdCtr.plPlayerController;
plPlayerController!.addStatusLister(playerListener); plPlayerController!.addStatusLister(playerListener);
vdCtr.autoPlay.value = true; vdCtr.autoPlay.value = true;
@ -266,7 +266,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
} }
vdCtr.isFirstTime = false; vdCtr.isFirstTime = false;
final bool autoplay = autoPlayEnable; final bool autoplay = autoPlayEnable;
vdCtr.playerInit(autoplay: autoplay); vdCtr.playerInit();
/// 未开启自动播放时,未播放跳转下一页返回/播放后跳转下一页返回 /// 未开启自动播放时,未播放跳转下一页返回/播放后跳转下一页返回
vdCtr.autoPlay.value = !vdCtr.isShowCover.value; vdCtr.autoPlay.value = !vdCtr.isShowCover.value;