krocard 1f3f22a709 Encapsulate TrackSelectionOverrides in its own class
The current API exposes an `ImmutableMap` of
`TrackGroup` -> `TrackSelectionOverride`.
This has several disadvantages:
 - A difficult to use API for mutation
   (`ImmutableMap.Builder` doesn't support key removal).
 - There is no track selection specific methods,
   how the generic map API mapps to the selection override is not complex
   but to obvious for a casual reader.
 - The internal data type is exposed, making internal refactor difficult.

This was done to have the API ready as quick as possible.

When transitioning the clients to the map API in <unknown commit>,
it became clear that the map API was too verbose and not mapping
to the clients needs, so utility methods
were added to make operations clearer and more concise.

Nevertheless, having to use utility method to use easily and correctly
an API is not the sign of a good API.

This cl refactors the track selection API for several improvements:

 - Add a type `TrackSelectionParameters` that encapsulate the internal
   data structure (map currently).
 - For iteration, expose as a list.
 - Add a `Builder` for easy mutable operations.
 - Add track selection specific methods to avoid having utilities functions.
 - Those operations are the same as `DefaultTrackSelector.Parameters`
   for easier migration. (`setOverride` was renamed to `addOverride`)
 - Move `TrackSelection` classes outside of `TrackSelectionParameters`
   as their own top level classes.

The migration of the client code is straightforward as most of it
were already using the previously mentioned utility functions
that are now native methods.

The full migration has not been done yet, and is pending on this cl approval.

PiperOrigin-RevId: 405362719
2021-10-25 13:52:58 +01:00
..

UI module

Provides UI components for media playback.

Getting the module

The easiest way to use the module is to add it as a gradle dependency:

implementation 'com.google.android.exoplayer:exoplayer-ui:2.X.X'

where 2.X.X is the version, which must match the version of the other media modules being used.

Alternatively, you can clone this GitHub project and depend on the module locally. Instructions for doing this can be found in the top level README.