Defect fix for issue #1460

Defect fix: https://github.com/react-native-community/react-native-video/issues/1460
This commit is contained in:
sridhar 2019-01-30 22:43:12 +05:30
parent 8dd782d91e
commit 938cfd64a5

View File

@ -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,15 +894,13 @@ class ReactExoplayerView extends FrameLayout implements
groupIndex = getGroupIndexForDefaultLocale(groups);
}
if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO) { // Video auto
if (groups.length != 0) {
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);
return;