Skip to content

Commit 4443622

Browse files
committed
PlayerData: subtitle idx fix
1 parent 6c17b62 commit 4443622

File tree

1 file changed

+6
-1
lines changed
  • common/src/main/java/com/liskovsoft/smartyoutubetv2/common/prefs

1 file changed

+6
-1
lines changed

common/src/main/java/com/liskovsoft/smartyoutubetv2/common/prefs/PlayerData.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ private void restoreState() {
774774

775775
String[] split = Helpers.splitData(data);
776776

777+
int yellowOnSemiBgSubIdx = 4;
777778
mOKButtonBehavior = Helpers.parseInt(split, 0, OK_ONLY_UI);
778779
mUiHideTimeoutSec = Helpers.parseInt(split, 1, 3);
779780
// mIsAbsoluteDateEnabled
@@ -787,7 +788,7 @@ private void restoreState() {
787788
mAudioFormat = Helpers.firstNonNull(ExoFormatItem.from(Helpers.parseStr(split, 10)), getDefaultAudioFormat());
788789
mSubtitleFormat = Helpers.firstNonNull(ExoFormatItem.from(Helpers.parseStr(split, 11)), getDefaultSubtitleFormat());
789790
mVideoBufferType = Helpers.parseInt(split, 12, PlayerEngine.BUFFER_MEDIUM);
790-
mSubtitleStyleIndex = Helpers.parseInt(split, 13, 4); // yellow on semi bg
791+
mSubtitleStyleIndex = Helpers.parseInt(split, 13, yellowOnSemiBgSubIdx);
791792
mResizeMode = Helpers.parseInt(split, 14, PlayerEngine.RESIZE_MODE_DEFAULT);
792793
mSpeed = Helpers.parseFloat(split, 15, 1.0f);
793794
mIsAfrEnabled = Helpers.parseBoolean(split, 16, false);
@@ -846,6 +847,10 @@ private void restoreState() {
846847
if (!mIsAllSpeedEnabled) {
847848
mSpeed = 1.0f;
848849
}
850+
851+
if (mSubtitleStyleIndex >= mSubtitleStyles.size()) {
852+
mSubtitleStyleIndex = yellowOnSemiBgSubIdx;
853+
}
849854
}
850855

851856
public void persistNow() {

0 commit comments

Comments
 (0)