Open CallBackMe opened 2 weeks ago
You can't and you can warn your designer that this media session surface is handled by the OS so will look different on nearly all OEMs.
You can't and you can warn your designer that this media session surface is handled by the OS so will look different on nearly all OEMs. Now the question is what other apps can do it. The designer thought it was better and asked us to complete it in that style.
Hi @CallBackMe,
I guess the other apps that are able to do it because they target below Android 13 (API 33). To experiment with demo-session app, you can change the appTargetSdkVersion
to 31 at below line:
https://github.com/androidx/media/blob/c35a9d62baec57118ea898e271ac66819399649b/constants.gradle#L20
The proposed UI from your designer is more likely to be based on that version. However, please checkout the target SDK requirement to see how targeting an older version can impact your app.
From Android 13 onwards, the notification UI is as your first picture shows, where a large play/pause button at the right side and a button slot at the left of the progress bar. And as @Tolriq has pointed out, notification UI is handled by the OS and may vary across OEMs, so we can hardly make the fundamental changes (eg. hide that large play/pause button or move the progress bar to cover a button slot).
The current reality is like this:
However, the effect the product designer wants is as shown below. How to adjust the play/previous/next position?
The version I am currently using is the latest version. { media3Exoplayer = "1.4.1"
androidx-media3-common = { module = "androidx.media3:media3-common", version.ref = "media3Exoplayer" } androidx-media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3Exoplayer" } androidx-media3-exoplayer-dash = { module = "androidx.media3:media3-exoplayer-dash", version.ref = "media3Exoplayer" } androidx-media3-session = { module = "androidx.media3:media3-session", version.ref = "media3Exoplayer" } androidx-media3-ui = { module = "androidx.media3:media3-ui", version.ref = "media3Exoplayer" } }
But I set { val sessionExtras = Bundle() sessionExtras.putBoolean(MediaConstants.EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_PREV, true) sessionExtras.putBoolean(MediaConstants.EXTRAS_KEY_SLOT_RESERVATION_SEEK_TO_NEXT, true) mediaSession?.sessionExtras = sessionExtras } The display effect is as shown below: