html: Update MediaSession setPositionState method (#40793)

The MediaSession `setPositionState` method should only update the
position state and propagate it to the platform media session UI
controller and shouldn't change somehow the properties of the media
element directly (duration, playback rate or position).
    
See
https://w3c.github.io/mediasession/#dom-mediasession-setpositionstate
    
Testing: Improvements in the following tests
- /mediasession/positionstate.html
    
The media session UI functionality is implemented for Android and didn't
test due lack of testing sample.

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
This commit is contained in:
Andrei Volykhin
2025-11-24 19:47:36 +03:00
committed by GitHub
parent 563bad4885
commit 2937300a9e
4 changed files with 39 additions and 58 deletions

View File

@@ -2844,18 +2844,6 @@ impl HTMLMediaElement {
media_session.send_event(event);
}
pub(crate) fn set_duration(&self, duration: f64) {
self.duration.set(duration);
}
pub(crate) fn reset(&self) {
if let Some(ref player) = *self.player.borrow() {
if let Err(err) = player.lock().unwrap().stop() {
error!("Could not stop player {:?}", err);
}
}
}
/// <https://html.spec.whatwg.org/multipage/#concept-media-load-resource>
pub(crate) fn origin_is_clean(&self) -> bool {
// Step 5.local (media provider object).