From 938cfd64a59c257e596b70cc5513399ae974d624 Mon Sep 17 00:00:00 2001 From: sridhar Date: Wed, 30 Jan 2019 22:43:12 +0530 Subject: [PATCH] Defect fix for issue #1460 Defect fix: https://github.com/react-native-community/react-native-video/issues/1460 --- .../brentvatne/exoplayer/ReactExoplayerView.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 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 08021479..655e4e28 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -876,7 +876,7 @@ class ReactExoplayerView extends FrameLayout implements TrackGroup group = groups.get(i); for (int j = 0; j < group.length; j++) { Format format = group.getFormat(j); - if (format.height == value.asInt()) { + if (format.height == height) { groupIndex = i; tracks[0] = j; break; @@ -894,14 +894,12 @@ class ReactExoplayerView extends FrameLayout implements groupIndex = getGroupIndexForDefaultLocale(groups); } - if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO) { // Video auto - if (groups.length != 0) { - TrackGroup group = groups.get(0); - tracks = new int[group.length]; - groupIndex = 0; - for (int j = 0; j < group.length; j++) { - tracks[j] = j; - } + if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO && groups.length > 0) { // Video auto + TrackGroup group = groups.get(0); + tracks = new int[group.length]; + groupIndex = 0; + for (int j = 0; j < group.length; j++) { + tracks[j] = j; } } else if (groupIndex == C.INDEX_UNSET) { trackSelector.setParameters(disableParameters);