Source:
public void setSelectedTextTrack(String type, Dynamic value) { textTrackType = type; textTrackValue = value; int index = getTextTrackRendererIndex(); if (index == C.INDEX_UNSET) { return; } MappingTrackSelector.MappedTrackInfo info = trackSelector.getCurrentMappedTrackInfo(); if (info == null) { return; } TrackGroupArray groups = info.getTrackGroups(index); int trackIndex = C.INDEX_UNSET; if (TextUtils.isEmpty(type)) { } else if (type.equals("disabled")) { trackSelector.setSelectionOverride(index, groups, null); return; } else if (type.equals("language")) { for (int i = 0; i < groups.length; ++i) { Format format = groups.get(i).getFormat(0); if (format.language != null && format.language.equals(value.asString())) { trackIndex = i; break; } } } else if (type.equals("title")) { for (int i = 0; i < groups.length; ++i) { Format format = groups.get(i).getFormat(0); if (format.id != null && format.id.equals(value.asString())) { trackIndex = i; break; } } } else if (type.equals("index")) { trackIndex = value.asInt(); } else { trackSelector.clearSelectionOverrides(index); trackSelector.setSelectionOverride(index, groups, null); int sdk = android.os.Build.VERSION.SDK_INT; if (sdk>18 && groups.length>0) { CaptioningManager captioningManager = (CaptioningManager) themedReactContext.getSystemService(Context.CAPTIONING_SERVICE); if (captioningManager.isEnabled()) trackIndex=0; } else return; } if (trackIndex == C.INDEX_UNSET) { trackSelector.clearSelectionOverrides(trackIndex); return; } MappingTrackSelector.SelectionOverride override = new MappingTrackSelector.SelectionOverride( new FixedTrackSelection.Factory(), trackIndex, 0); trackSelector.setSelectionOverride(index, groups, override); }

Target:
public void setSelectedTextTrack(String type, Dynamic value) { textTrackType = type; textTrackValue = value; int index = getTextTrackRendererIndex(); if (index == C.INDEX_UNSET) { return; } MappingTrackSelector.MappedTrackInfo info = trackSelector.getCurrentMappedTrackInfo(); if (info == null) { return; } TrackGroupArray groups = info.getTrackGroups(index); int trackIndex = C.INDEX_UNSET; trackSelector.setSelectionOverride(index, groups, null); if (TextUtils.isEmpty(type)) { } else if (type.equals("disabled")) { return; } else if (type.equals("language")) { for (int i = 0; i < groups.length; ++i) { Format format = groups.get(i).getFormat(0); if (format.language != null && format.language.equals(value.asString())) { trackIndex = i; break; } } } else if (type.equals("title")) { for (int i = 0; i < groups.length; ++i) { Format format = groups.get(i).getFormat(0); if (format.id != null && format.id.equals(value.asString())) { trackIndex = i; break; } } } else if (type.equals("index")) { trackIndex = value.asInt(); } else { int sdk = android.os.Build.VERSION.SDK_INT; if (sdk>18 && groups.length>0) { CaptioningManager captioningManager = (CaptioningManager) themedReactContext.getSystemService(Context.CAPTIONING_SERVICE); if (captioningManager.isEnabled()) { trackIndex = 0; String locale = Locale.getDefault().getDisplayLanguage(); for (int i = 0; i < groups.length; ++i) { Format format = groups.get(i).getFormat(0); if (format.language != null && format.language.equals(locale)) { trackIndex = i; break; } } } } else return; } if (trackIndex == C.INDEX_UNSET) { trackSelector.clearSelectionOverrides(trackIndex); return; } MappingTrackSelector.SelectionOverride override = new MappingTrackSelector.SelectionOverride( new FixedTrackSelection.Factory(), trackIndex, 0); trackSelector.setSelectionOverride(index, groups, override); }