Use the current overrides of the player as preset

Issue: google/ExoPlayer#10429
PiperOrigin-RevId: 461577039
This commit is contained in:
bachinger 2022-07-18 10:36:01 +00:00 committed by Rohit Singh
parent 0db07c6791
commit f828130caf

View File

@ -65,7 +65,7 @@ public final class TrackSelectionDialogBuilder {
private boolean showDisableOption; private boolean showDisableOption;
@Nullable private TrackNameProvider trackNameProvider; @Nullable private TrackNameProvider trackNameProvider;
private boolean isDisabled; private boolean isDisabled;
private Map<TrackGroup, TrackSelectionOverride> overrides; private ImmutableMap<TrackGroup, TrackSelectionOverride> overrides;
@Nullable private Comparator<Format> trackFormatComparator; @Nullable private Comparator<Format> trackFormatComparator;
/** /**
@ -85,7 +85,7 @@ public final class TrackSelectionDialogBuilder {
this.title = title; this.title = title;
this.trackGroups = ImmutableList.copyOf(trackGroups); this.trackGroups = ImmutableList.copyOf(trackGroups);
this.callback = callback; this.callback = callback;
overrides = Collections.emptyMap(); overrides = ImmutableMap.of();
} }
/** /**
@ -108,7 +108,7 @@ public final class TrackSelectionDialogBuilder {
trackGroups.add(trackGroup); trackGroups.add(trackGroup);
} }
} }
overrides = Collections.emptyMap(); overrides = player.getTrackSelectionParameters().overrides;
callback = callback =
(isDisabled, overrides) -> { (isDisabled, overrides) -> {
TrackSelectionParameters.Builder parametersBuilder = TrackSelectionParameters.Builder parametersBuilder =
@ -169,7 +169,7 @@ public final class TrackSelectionDialogBuilder {
*/ */
public TrackSelectionDialogBuilder setOverrides( public TrackSelectionDialogBuilder setOverrides(
Map<TrackGroup, TrackSelectionOverride> overrides) { Map<TrackGroup, TrackSelectionOverride> overrides) {
this.overrides = overrides; this.overrides = ImmutableMap.copyOf(overrides);
return this; return this;
} }