Skip to content

Commit ad42800

Browse files
tianyiftonihei
authored andcommitted
Update notification play/pause button with matching player state
Issue: #192 PiperOrigin-RevId: 508649684 (cherry picked from commit e1d12fc)
1 parent 5822d68 commit ad42800

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

RELEASENOTES.md

+21
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,27 @@ This release corresponds to the
145145
* Make `QueueTimeline` more robust in case of a shady legacy session state
146146
([#241](https://github.com/androidx/media/issues/241)).
147147
* Cast extension:
148+
* Fix a bug where notification play/pause button doesn't update with
149+
player state ([#192](https://github.com/androidx/media/issues/192)).
150+
* Metadata:
151+
* Parse multiple null-separated values from ID3 frames, as permitted by
152+
ID3 v2.4.
153+
* Add `MediaMetadata.mediaType` to denote the type of content or the type
154+
of folder described by the metadata.
155+
* Add `MediaMetadata.isBrowsable` as a replacement for
156+
`MediaMetadata.folderType`. The folder type will be deprecated in the
157+
next release.
158+
* Transformer:
159+
* Remove `Transformer.Builder.setMediaSourceFactory(MediaSource.Factory)`.
160+
Use `ExoPlayerAssetLoader.Factory(MediaSource.Factory)` and
161+
`Transformer.Builder.setAssetLoaderFactory(AssetLoader.Factory)`
162+
instead.
163+
* Remove `Transformer.startTransformation(MediaItem,
164+
ParcelFileDescriptor)`.
165+
* Remove deprecated symbols:
166+
* Remove `DefaultAudioSink` constructors, use `DefaultAudioSink.Builder`
167+
instead.
168+
* Cast extension
148169
* Bump Cast SDK version to 21.2.0.
149170
* IMA extension:
150171
* Map `PLAYER_STATE_LOADING` to `STATE_BUFFERING`

libraries/session/src/main/java/androidx/media3/session/MediaNotificationManager.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,11 @@ private void updateNotificationInternal(
219219
if (startInForegroundRequired) {
220220
startForeground(mediaNotification);
221221
} else {
222-
maybeStopForegroundService(/* removeNotifications= */ false);
222+
// Notification manager has to be updated first to avoid missing updates
223+
// (https://github.com/androidx/media/issues/192).
223224
notificationManagerCompat.notify(
224225
mediaNotification.notificationId, mediaNotification.notification);
226+
maybeStopForegroundService(/* removeNotifications= */ false);
225227
}
226228
}
227229

0 commit comments

Comments
 (0)