fixed: disabled caption to no longer automatically re-enable on new player instance.
This commit is contained in:
parent
6e81f2430b
commit
4917da2d2e
|
@ -3557,14 +3557,19 @@ public final class Player implements
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply caption language from previous user preference
|
// apply caption language from previous user preference
|
||||||
final List<String> selectedPreferredLanguages =
|
|
||||||
trackSelector.getParameters().preferredTextLanguages;
|
|
||||||
final String userPreferredLanguage =
|
final String userPreferredLanguage =
|
||||||
prefs.getString(context.getString(R.string.caption_user_set_key), null);
|
prefs.getString(context.getString(R.string.caption_user_set_key), null);
|
||||||
final int textRendererIndex = getCaptionRendererIndex();
|
final int textRendererIndex = getCaptionRendererIndex();
|
||||||
|
|
||||||
if (userPreferredLanguage != null
|
if (userPreferredLanguage == null) {
|
||||||
&& !selectedPreferredLanguages.contains(userPreferredLanguage)
|
trackSelector.setParameters(trackSelector.buildUponParameters()
|
||||||
|
.setRendererDisabled(textRendererIndex, true));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<String> selectedPreferredLanguages =
|
||||||
|
trackSelector.getParameters().preferredTextLanguages;
|
||||||
|
if (!selectedPreferredLanguages.contains(userPreferredLanguage)
|
||||||
&& textRendererIndex != RENDERER_UNAVAILABLE) {
|
&& textRendererIndex != RENDERER_UNAVAILABLE) {
|
||||||
trackSelector.setParameters(trackSelector.buildUponParameters()
|
trackSelector.setParameters(trackSelector.buildUponParameters()
|
||||||
.setPreferredTextLanguages(userPreferredLanguage,
|
.setPreferredTextLanguages(userPreferredLanguage,
|
||||||
|
|
Loading…
Reference in New Issue