Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom track ordering in TrackSelectionView / TrackSelectionDialogBuilder #7709

Closed
yoobi opened this issue Aug 4, 2020 · 4 comments

Comments

@yoobi
Copy link
Contributor

yoobi commented Aug 4, 2020

[REQUIRED] Searched documentation and issues

I've looked around stackoverfow and multiple forums but they just use TrackSelectionDialog without sorting the format

[REQUIRED] Question

How can I sort the format inside TrackSelectionDialog ? I can't modify the videos as I'm just picking up the link from a WebService. Here is a screen of what I'm describing.

my TrackSelectionDialog displays the format in the following order: 480p, 720p, 1080p, 360p, 256p and I'd like to sort the format in the following order: 256p, 360p, 480p, 720p, 1080p.

This is my code:

trackSelectionDialogBuilder = TrackSelectionDialogBuilder(context, context.getString(R.string.qualitySelector), trackSelector, videoRenderer)
trackSelectionDialogBuilder.setTrackNameProvider {
    // Override function getTrackName
    context.getString(R.string.exo_track_resolution_pixel, it.height)
}
return trackSelectionDialogBuilder.build()
@ojw28
Copy link
Contributor

ojw28 commented Aug 4, 2020

There's no way to do this currently. I'll mark it as an enhancement.

In the meantime, it should be relatively easy for you to fork TrackSelectionDialogBuilder and TrackSelectionView into your own codebase, at which point you'll be able to customize them to exactly suit your use case.

@ojw28 ojw28 changed the title How to sort trackSelectionDialog format Support custom track ordering in TrackSelectionView / TrackSelectionDialogBuilder Aug 4, 2020
@yoobi
Copy link
Contributor Author

yoobi commented Aug 4, 2020

So you mean I should copy your TrackSelectionDialogBuilder and TrackSelectionView and change them to add this sortBy method ?

@ojw28
Copy link
Contributor

ojw28 commented Aug 4, 2020

We will use this issue to track adding support directly to the library, but in the meantime, yes, that's the easiest thing for you to do. You could also send a pull request directly to the project, if you're sufficiently motivated to do so!

@ojw28
Copy link
Contributor

ojw28 commented Sep 25, 2020

Pull request was merged. Thanks!

@ojw28 ojw28 closed this as completed Sep 25, 2020
@google google locked and limited conversation to collaborators Nov 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants