isPaused reverted

clearSelectionOverride is still required for "default" and "disabled" case as it otherwise continues to show a selected track if it was previously selected
This commit is contained in:
Ash Mishra 2018-07-09 16:18:42 -07:00
parent 572c11a1dc
commit 6339b9ac08

View File

@ -105,7 +105,7 @@ class ReactExoplayerView extends FrameLayout implements
private boolean loadVideoStarted; private boolean loadVideoStarted;
private boolean isFullscreen; private boolean isFullscreen;
private boolean isInBackground; private boolean isInBackground;
private boolean isPaused = true; private boolean isPaused;
private boolean isBuffering; private boolean isBuffering;
private float rate = 1f; private float rate = 1f;
@ -739,10 +739,11 @@ class ReactExoplayerView extends FrameLayout implements
TrackGroupArray groups = info.getTrackGroups(index); TrackGroupArray groups = info.getTrackGroups(index);
int trackIndex = C.INDEX_UNSET; int trackIndex = C.INDEX_UNSET;
trackSelector.setSelectionOverride(index, groups, null);
if (TextUtils.isEmpty(type)) { if (TextUtils.isEmpty(type)) {
// Do nothing // Do nothing
} else if (type.equals("disabled")) { } else if (type.equals("disabled")) {
trackSelector.setSelectionOverride(index, groups, null);
return; return;
} else if (type.equals("language")) { } else if (type.equals("language")) {
for (int i = 0; i < groups.length; ++i) { for (int i = 0; i < groups.length; ++i) {
@ -762,10 +763,7 @@ class ReactExoplayerView extends FrameLayout implements
} }
} else if (type.equals("index")) { } else if (type.equals("index")) {
trackIndex = value.asInt(); trackIndex = value.asInt();
} else { // default. invalid type or "system" } else { // default. Use system settings if possible
trackSelector.clearSelectionOverrides(index);
trackSelector.setSelectionOverride(index, groups, null);
int sdk = android.os.Build.VERSION.SDK_INT; int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk>18 && groups.length>0) { if (sdk>18 && groups.length>0) {
CaptioningManager captioningManager = (CaptioningManager) themedReactContext.getSystemService(Context.CAPTIONING_SERVICE); CaptioningManager captioningManager = (CaptioningManager) themedReactContext.getSystemService(Context.CAPTIONING_SERVICE);