getAvailableTracks() returning empty TrackGroupArray for RendererType VIDEO, even when tracks exist.
See original GitHub issue- I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
- ExoMedia version:
4.1.0
- Device OS version:
4.4
- Devide Manufacturer:
HTC
- Device Name:
Desire 526G Plus
Reproduction Steps
-
I have set videoView uri as -
videoView.setVideoURI(Uri.parse(url), new DashMediaSourceBuilder().build(context, Uri.parse (url), "some random string", null, null));
-
Then, in onPrepared, I do this -
if (videoView.trackSelectionAvailable()) { Map<ExoMedia.RendererType, TrackGroupArray> tracks = videoView.getAvailableTracks(); Log.e("tracks", " are " + tracks); for (ExoMedia.RendererType rendererType : tracks.keySet()) { TrackGroupArray trackGroupArray = tracks.get(rendererType); Log.e("Renderer", " is " + rendererType); Log.e("Length", " is " + trackGroupArray.length); for (int i = 0; i < trackGroupArray.length; i++) { Log.e("Track " + rendererType.toString() + " " + i, "is " + trackGroupArray .get(i).toString()); } } }
Expected Result
I open the mpd link in an xml viewer and find this, among other things -
Meaning, that there are 5 video tracks.
Actual Result
…E/tracks: are {CLOSED_CAPTION=com.google.android.exoplayer2.source.TrackGroupArray@1, AUDIO=com.google.android.exoplayer2.source.TrackGroupArray@4496699e, VIDEO=com.google.android.exoplayer2.source.TrackGroupArray@1} …E/Renderer: is CLOSED_CAPTION …E/Length: is 0 …E/Renderer: is AUDIO …E/Length: is 1 …E/Track AUDIO 0: is com.google.android.exoplayer2.source.TrackGroup@4496697f …E/Renderer: is VIDEO …E/Length: is 0
Why is the getAvailableTracks() method returning an array size of 0 for RendererType VIDEO and not able to find the video tracks?
Also, I think you should mention in the docs that one should only call getAvailableTracks() after onPrepared, else it will cause an NPE.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
See #541. You’ll need to update your version to
4.2.0
I’ve added a new method setTrack(RenderType, int, int) that correctly allows you to specify the group index in the
TrackGroupArray
. If you use the oldsetTrack(RenderType, int)
method it will default to0
for the group index which might not be what you want.