Skip to content

Commit

Permalink
fix(android): video tracks crash and clean (#3767)
Browse files Browse the repository at this point in the history
* perf: ensure we do not provide callback to native if no callback provided from app

* chore: rework bufferConfig to make it more generic and reduce ReactExoplayerView code size

* chore: improve issue template

* fix(android): avoid video view flickering at playback startup

* fix: fix crash when invalid index type is provided and minor clean up
  • Loading branch information
freeboub authored May 14, 2024
1 parent 98b4a75 commit 219496f
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ private VideoTrack exoplayerVideoTrackToGenericVideoTrack(Format format, int tra
videoTrack.setHeight(format.height == Format.NO_VALUE ? 0 : format.height);
videoTrack.setBitrate(format.bitrate == Format.NO_VALUE ? 0 : format.bitrate);
if (format.codecs != null) videoTrack.setCodecs(format.codecs);
videoTrack.setTrackId(format.id == null ? String.valueOf(trackIndex) : format.id);;
videoTrack.setTrackId(format.id == null ? String.valueOf(trackIndex) : format.id);
return videoTrack;
}

Expand Down Expand Up @@ -1798,9 +1798,14 @@ public void setSelectedTrack(int trackType, String type, String value) {
}
}
} else if ("index".equals(type)) {
int iValue = Integer.parseInt(value);
if (iValue < groups.length) {
groupIndex = iValue;
try {
int iValue = Integer.parseInt(value);
if (iValue < groups.length) {
groupIndex = iValue;
}
} catch (Exception e) {
DebugLog.e(TAG, "cannot parse index:" + value);
groupIndex = 0;
}
} else if ("resolution".equals(type)) {
int height = Integer.parseInt(value);
Expand Down Expand Up @@ -1866,7 +1871,6 @@ public void setSelectedTrack(int trackType, String type, String value) {
if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO && groups.length != 0) { // Video auto
// Add all tracks as valid options for ABR to choose from
TrackGroup group = groups.get(0);
tracks = new ArrayList<>(group.length);
ArrayList<Integer> allTracks = new ArrayList<>(group.length);
groupIndex = 0;
for (int j = 0; j < group.length; j++) {
Expand Down

0 comments on commit 219496f

Please sign in to comment.