From b2397374981bbb0232a5a5d9dd2de7bc2826581c Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Mon, 6 Jan 2025 17:26:28 +0800 Subject: [PATCH] fix: vttSubtitlesIndex Signed-off-by: bggRGjQaUbCoE --- lib/pages/video/detail/controller.dart | 10 ++++++---- lib/pages/video/detail/introduction/controller.dart | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index 9197e3b3..8cfa1c6e 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -1902,6 +1902,7 @@ class VideoDetailController extends GetxController SettingBoxKey.subtitlePreference, defaultValue: SubtitlePreference.values.first.code, ); + vttSubtitlesIndex = 0; if (preference == 'on') { vttSubtitlesIndex = 1; } else if (preference == 'withoutAi') { @@ -1915,9 +1916,11 @@ class VideoDetailController extends GetxController } if (plPlayerController.vttSubtitles.isEmpty) { plPlayerController.vttSubtitles.value = _vttSubtitles; - plPlayerController.vttSubtitlesIndex.value = vttSubtitlesIndex!; - if (vttSubtitlesIndex != 0) { - plPlayerController.setSubtitle(vttSubtitlesIndex!); + if (vttSubtitlesIndex != null) { + plPlayerController.vttSubtitlesIndex.value = vttSubtitlesIndex!; + if (vttSubtitlesIndex != 0) { + plPlayerController.setSubtitle(vttSubtitlesIndex!); + } } } } @@ -1988,7 +1991,6 @@ class VideoDetailController extends GetxController } catch (_) {} } - vttSubtitlesIndex = 0; if (res["data"] is List && res["data"].isNotEmpty) { var result = await VideoHttp.vttSubtitles(res["data"]); if (result != null) { diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index 19dddea8..eec40350 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -719,7 +719,7 @@ class VideoIntroController extends GetxController } final int currentIndex = - episodes.indexWhere((e) => e.cid == lastPlayCid.value); + episodes.indexWhere((e) => e.cid == videoDetailCtr.cid.value); int nextIndex = currentIndex + 1; if (videoDetailCtr.isPlayAll && currentIndex == episodes.length - 2) {