question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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
  1. I have set videoView uri as -

    videoView.setVideoURI(Uri.parse(url), new DashMediaSourceBuilder().build(context, Uri.parse
            (url), "some random string", null, null));  
    
  2. 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 -

video tracks

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:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
brianwernickcommented, May 18, 2018

See #541. You’ll need to update your version to 4.2.0

0reactions
brianwernickcommented, Jul 25, 2018

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 old setTrack(RenderType, int) method it will default to 0 for the group index which might not be what you want.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found