-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why automatic handling of audio focus is not updating app and notification with "pause"? #11213
Comments
This is an interesting question and something we couldn't find a good answer for in previous discussions. It all comes down to: "what do you expect to happen when you use the play/pause button while audio focus is lost transiently (e.g. during phone call or notification sound)?" The two options are:
The current UI behavior actually lets you do both:
|
@tonihei I want to achieve the same behaviour like YouTubeMusic. Because currently when audio focus is lost transiently UAMP keeps showing the notification with pause button (like it's playing at the moment and that looks weird) |
Yes, I understand what you are asking for. My post was trying to explain the decision issue behind: "which button should we show the user?" and that there is no obvious right or wrong way of doing this. I'll try to see if there is specific guidance we should apply by default and/or whether we can provide an option for apps to choose the behavior. |
We decided that we'll change our default logic to show a "play" button in such a case and also provide a way to override this default if desired by apps. Marking it as an enhancement to track this work. |
This changes the default logic of shouldShowPlayButton to show a play button while the playback is temporarily suppressed. This helps to provide better UI feedback to the fact that playback stopped and provides a quick way for users to override the suppression and attempt to restart playback. Some apps may want to keep the legacy behavior depending on their app's needs. Hence, we also add a config parameter to set this behavior both in MediaSession and our default UI components. Issue: google/ExoPlayer#11213 PiperOrigin-RevId: 557129171
This changes the default logic of shouldShowPlayButton to show a play button while the playback is temporarily suppressed. This helps to provide better UI feedback to the fact that playback stopped and provides a quick way for users to override the suppression and attempt to restart playback. Some apps may want to keep the legacy behavior depending on their app's needs. Hence, we also add a config parameter to set this behavior both in MediaSession and our default UI components. Issue: #11213 PiperOrigin-RevId: 557129171
This is now implemented by default and will be published as part of the next Media3 release. |
This changes the default logic of shouldShowPlayButton to show a play button while the playback is temporarily suppressed. This helps to provide better UI feedback to the fact that playback stopped and provides a quick way for users to override the suppression and attempt to restart playback. Some apps may want to keep the legacy behavior depending on their app's needs. Hence, we also add a config parameter to set this behavior both in MediaSession and our default UI components. Issue: google/ExoPlayer#11213 PiperOrigin-RevId: 557129171
MediaSession is not updated when audio focus is temporarily lost
For example, switching to Facebook short videos. UAMP app: music paused, notification keeps showing the pause button(like it's playing at the moment).
In other cases I'm ok with
setAudioAttributes(audioAttributes, handleAudioFocus = true)
but there is no way to handle this case.
my notification is fully handled by
com.google.android.exoplayer2.ui.PlayerNotificationManager
For example YouTubeMusic app updates the notification button and shows "play" button when focus is temporarily taken by facebook. The same issue when receiving a phone call.
Android Auto buttons work the same.
Event
EVENT_PLAYBACK_SUPPRESSION_REASON_CHANGED
is not helpingThe text was updated successfully, but these errors were encountered: