Changing MediaMetadata properties does not notify MediaSession
| Tracking | Status | |
|---|---|---|
| firefox149 | --- | fixed |
| Assignee | |
Descriptionβ’4 months ago
|
Steps to reproduce:
- Open a page that creates a MediaSession and starts media playback.
- Assign a MediaMetadata object to navigator.mediaSession.metadata.
- After playback has started, update a property on the existing MediaMetadata object (for example, change metadata.title).
- Observe the media information shown in system media controls.
Actual results:
The updated metadata is reflected in system media controls.
Expected results:
The media metadata does not update unless a new MediaMetadata object is assigned to navigator.mediaSession.metadata.
Comment 1β’4 months ago
|
The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2β’4 months ago
|
It appears the Chrome does indeed schedule an event to update the session after a MediaMetadata attribute is updated, as it saves a pointer to its owning MediaSession:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/mediasession/media_metadata.cc;drc=731d7da69af6d3c1b97ff8e72cd2b85c872a18a8;l=97
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/mediasession/media_session.cc;drc=731d7da69af6d3c1b97ff8e72cd2b85c872a18a8;l=181
whereas we do nothing when we set the attributes:
https://searchfox.org/firefox-main/rev/93aad2a6615f670b1279c229dd37f7397236131a/dom/media/mediasession/MediaMetadata.cpp#56
when we would want to call MediaSession::NotifyMetadataUpdated just like we do when we set the metadata:
https://searchfox.org/firefox-main/rev/93aad2a6615f670b1279c229dd37f7397236131a/dom/media/mediasession/MediaSession.cpp#121
The W3C MediaSession spec is pretty clear that is what we are supposed to do
When MediaMetadataβs title, artist, album or artwork images are modified, the user
agent MUST run the following steps:
1. If the instance has no associated media session, abort these steps.
2. Otherwise, queue a task to run the following substeps:
1. If the instance no longer has an associated media session, abort these steps.
2. Otherwise, in parallel, run the update metadata algorithm.
| Assignee | |
Comment 3β’4 months ago
|
Updatedβ’4 months ago
|
Updatedβ’4 months ago
|
Comment 4β’4 months ago
|
Comment 5β’4 months ago
|
|
| bugherder | |
Updatedβ’4 months ago
|
Updatedβ’3 months ago
|
