mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00

The legacy custom layout doesn't support disabled buttons or buttons with non-custom actions. These are currently filtered out, but in inconsistent ways: - MediaControllerImplBase doesn't filter at all. - DefaultNotificationProvider filters before converting mediaButtonPreferences, PlayerWrapper filters after the conversion. - PlayerWrapper doesn't disable buttons that are unavailable. To ensure it's consistent, we can add these checks to the existing util method in CommandButton and also make sure PlayerWrapper disables unavailable buttons before triggering the util method. This also means we can simplify some of the tests that rely on the mediaButtonPreference to customLayout conversion in MediaController. This change also includes two bug fixes in PlayerWrapper that became evident in the tests: The extras need to be copied to avoid modifying a Bundle instance that be used elsewhere and we need to update the custom layout and potentially the session extras when the available commands change, as they depend on them. PiperOrigin-RevId: 704678404
Session module
This module provides media session functionality through which media information and controls can be exposed to the Android platform, as well as to other processes and applications.
Getting the module
The easiest way to get the module is to add it as a gradle dependency:
implementation 'androidx.media3:media3-session:1.X.X'
where 1.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.