fix: vttSubtitlesIndex

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-06 17:26:28 +08:00
parent 5001f3b6d2
commit b239737498
2 changed files with 7 additions and 5 deletions

View File

@@ -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) {