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.

Add preferred mime type(s) to DefaultTrackSelector parameters

See original GitHub issue

I’d like to implement a customized TrackSelector. My situations are

  1. I don’t want to change any code of ExoPlayer core library so that I’ll not modify DefaultTrackSelector directly;
  2. I know I can do some kinds of customization via setParameter API.

trackSelector.setParameters( trackSelector .buildUponParameters() .setMaxVideoSizeSd() .setPreferredAudioLanguage("deu"));

But Current APIs can’t satisfy my requirement. For example, I’d like to always set higher priority for Dolby Digital plus track than AAC audio track. It seems that current interface can’t support it.

According to ExoPlayer official documentation (https://exoplayer.dev/customization.html),

TrackSelector – Implementing a custom TrackSelector allows an app developer to change the way in which tracks exposed by a MediaSource are selected for consumption by each of the available Renderers.

My first feeling is I need to copy all files under “library\core\src\main\java\com\google\android\exoplayer2\trackselection” folder into my application layer and then do some modification. Do you have any suggestion for this? Is there a better solution?

Thank you very much in advance.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ybai001commented, Dec 15, 2020

I hope your team can help to implement it since it will be more quickly to be merged. Thanks a lot in advance.

2reactions
toniheicommented, Dec 14, 2020

I’m not sure which proposal is better: setPreferredMimeType(String mimeType) or setPreferredMimeTypes(String[] mimeTypes) For example, prefering “eac3”, “eac3-joc”, “ac-4” over “aac” while “eac3”, “eac3-joc” and “ac-4” have same “MIME type based” priority (so that channel count/sample rate/… will decide the final priority of eac3/eac3-joc/ac-4) . That is to say, the parameter is a string[]. Proposal 1 is easier while proposal 2 is more general. Both proposals can satisfy our current customer requirement so that you may decide it from platform perspective

In a similar case for languages we have two methods setPreferredAudioLanguage(String) and setPreferredAudioLanguages(String...), which both end up in an ImmutableList<String> in the Parameters object (with one or many elements). I think we can just do the same here. I’ll mark as an enhancement for now. Are you thinking about providing a PR yourself or shall we implement this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

DefaultTrackSelector.Parameters (ExoPlayer library)
Parameters by adding fields that are specific to DefaultTrackSelector . ... Whether to allow adaptive audio selections containing mixed MIME types.
Read more >
DefaultTrackSelector.Parameters - Android Developers
Extends Parameters by adding fields that are specific to ... Adaptations between different MIME types may not be completely seamless.
Read more >
com.google.android.exoplayer2.trackselection ... - Tabnine
DefaultTrackSelector $ParametersBuilder ... Tests that track selector will prefer tracks that are within renderer's capabilities over * track that have both ...
Read more >
DefaultTrackSelector.Parameters (library API) - javadoc.io
Constructor with default selection parameters: No preferred audio language is set. ... Adaptation between different mime types is not allowed.
Read more >
DefaultTrackSelector - androidx.* javadoc
AdaptiveSupport for mixed MIME type adaptation for the renderer. ... Extends {@link Parameters} by adding fields that are specific to {@link ...
Read more >

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