Skip to content

Overrides not populated by default in TrackSelectionDialogBuilder #10429

Closed

Description

@TheBeastLT

ExoPlayer Version

2.18.0

Devices that reproduce the issue

Any

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

When building TrackSelectionDialogBuilder using constructor with the Player argument, builder does not take into account existing overrides and by default the dialog will always select Auto option.

Expected result

In the TrackSelectionDialogBuilder constructor it could already take available overrides from the player instance via player.getTrackSelectionParameters().getOverrides() instead of having empty map:


So that you wouldn't need to explore the source code to understand why the previous selection in the dialog is not pre-selected when opening the dialog again.

Actual result

When constructing TrackSelectionDialogBuilder the overrides are left empty and you have to know that you need to provide them manually via .setOverrides(player.getTrackSelectionParameters().getOverrides())

Media

Not applicable

Bug Report

Activity

  1. marcbaechinger commented on Jul 13, 2022

    @marcbaechinger
    Contributor

    Thanks for reporting!

    To achieve what you want I think you can do

    TrackSelectionDialogBuilder builder =
              new TrackSelectionDialogBuilder(this, "Select tracks", player, C.TRACK_TYPE_VIDEO)
              .setOverrides(player.getTrackSelectionParameters().overrides);
    

    I'm not sure about whether not setting the overrides in the constructor is the intended behaviour. It's meant to present the dialog without a pre-selection. The selection then can be done by using the setter TrackSelectionDialogBuilder.setOverrides(Map).

    Agreed that it could be the other way around and then to prevent a preselection, an app can do TrackSelectionDialogBuilder.setOverrides(Collections.emptyMap()).

    We need to discuss internally whether we want to change this to default to a pre-selection when the player is passed. Do you agree I change this from bug to enhancement? As in, by using the setter you can achieve what you want?

  2. TheBeastLT commented on Jul 14, 2022

    @TheBeastLT
    Author

    To achieve what you want I think you can do

    TrackSelectionDialogBuilder builder =
              new TrackSelectionDialogBuilder(this, "Select tracks", player, C.TRACK_TYPE_VIDEO)
          .setOverrides(player.getTrackSelectionParameters().overrides);
    

    Yes, that's what I do now, just that I had to dig into code a bit to understand why the previous selection was not saved and would always reset. So that waa a bit confusing and unexpected, if you have to use this dialog.

    Do you agree I change this from bug to enhancement?

    Sure, that's fine.

  3. added a commit that references this issue on Aug 8, 2022
  4. locked and limited conversation to collaborators on Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions