From 6339b9ac0890f880c98bdf75fe0d162624587a53 Mon Sep 17 00:00:00 2001 From: Ash Mishra Date: Mon, 9 Jul 2018 16:18:42 -0700 Subject: [PATCH] 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 --- .../com/brentvatne/exoplayer/ReactExoplayerView.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index a8022141..9a036c25 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -105,7 +105,7 @@ class ReactExoplayerView extends FrameLayout implements private boolean loadVideoStarted; private boolean isFullscreen; private boolean isInBackground; - private boolean isPaused = true; + private boolean isPaused; private boolean isBuffering; private float rate = 1f; @@ -739,10 +739,11 @@ class ReactExoplayerView extends FrameLayout implements TrackGroupArray groups = info.getTrackGroups(index); int trackIndex = C.INDEX_UNSET; + trackSelector.setSelectionOverride(index, groups, null); + if (TextUtils.isEmpty(type)) { // Do nothing } else if (type.equals("disabled")) { - trackSelector.setSelectionOverride(index, groups, null); return; } else if (type.equals("language")) { for (int i = 0; i < groups.length; ++i) { @@ -762,10 +763,7 @@ class ReactExoplayerView extends FrameLayout implements } } else if (type.equals("index")) { trackIndex = value.asInt(); - } else { // default. invalid type or "system" - trackSelector.clearSelectionOverrides(index); - trackSelector.setSelectionOverride(index, groups, null); - + } else { // default. Use system settings if possible int sdk = android.os.Build.VERSION.SDK_INT; if (sdk>18 && groups.length>0) { CaptioningManager captioningManager = (CaptioningManager) themedReactContext.getSystemService(Context.CAPTIONING_SERVICE);