fix: 未播放时返回当前页异常

This commit is contained in:
guozhigq
2024-08-24 23:33:19 +08:00
parent 46b16d5087
commit 9082f0299d

View File

@ -63,7 +63,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
late bool autoPlayEnable; late bool autoPlayEnable;
late bool autoPiP; late bool autoPiP;
late Floating floating; late Floating floating;
bool isShowing = true; RxBool isShowing = true.obs;
// 生命周期监听 // 生命周期监听
late final AppLifecycleListener _lifecycleListener; late final AppLifecycleListener _lifecycleListener;
late double statusHeight; late double statusHeight;
@ -183,6 +183,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
plPlayerController!.addStatusLister(playerListener); plPlayerController!.addStatusLister(playerListener);
vdCtr.autoPlay.value = true; vdCtr.autoPlay.value = true;
vdCtr.isShowCover.value = false; vdCtr.isShowCover.value = false;
isShowing.value = true;
autoEnterPip(status: PlayerStatus.playing); autoEnterPip(status: PlayerStatus.playing);
} }
@ -258,7 +259,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
plPlayerController!.pause(); plPlayerController!.pause();
vdCtr.clearSubtitleContent(); vdCtr.clearSubtitleContent();
} }
setState(() => isShowing = false); isShowing.value = false;
super.didPushNext(); super.didPushNext();
} }
@ -272,10 +273,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
if (plPlayerController != null && if (plPlayerController != null &&
plPlayerController!.videoPlayerController != null) { plPlayerController!.videoPlayerController != null) {
setState(() { vdCtr.setSubtitleContent();
vdCtr.setSubtitleContent(); isShowing.value = true;
isShowing = true;
});
} }
vdCtr.isFirstTime = false; vdCtr.isFirstTime = false;
final bool autoplay = autoPlayEnable; final bool autoplay = autoPlayEnable;