
The max number of commands for media items of a browser or controller can be configured with `setMaxCommandsForMediaItems(int)` on `MediaController.Builder` and `MediaBrowser.Builder`. An app that has only limited space for displaying commands can hint this limit to the session. A session can receive the value of a connected browser or controller through `getMaxCommandsForMediaItems()` of a `ControllerInfo` that is passed into every callback method. The session can then pick the most sensible commands instead of making the browser app truncating the commands rather randomly. When a `MediaBrowser` is connected against a legacy `MediaBrowserServiceCompat`, the max number of commands is automatically added to the root hints. Conversely, the value passed in with the root hints to `MediaLibraryService` by a legacy `MediaBrowserCompat`, is read into `ControllerInfo` like for a Media3 browser. Issue: androidx/media#1474 #cherrypick PiperOrigin-RevId: 679076506
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.