Skip to content

media: Fix the order of events for autoplay media#56014

Merged
jdm merged 1 commit intoweb-platform-tests:masterfrom
tharkum:html-media-event-order-autoplay
Nov 14, 2025
Merged

media: Fix the order of events for autoplay media#56014
jdm merged 1 commit intoweb-platform-tests:masterfrom
tharkum:html-media-event-order-autoplay

Conversation

@tharkum
Copy link
Copy Markdown
Contributor

@tharkum tharkum commented Nov 13, 2025

Following the HTML specification, the expected order of events for autoplaying media tests (<video autoplay>) has been corrected:

  • non-autoplay: canplay, canplaythrough (same as before)
  • autoplay: canplay, canplaythrough, play, playing (canplaythrough should be right after canplay, not after playing)

https://html.spec.whatwg.org/multipage/#ready-states:event-media-canplaythrough

WhatWG PR: whatwg/html#1409

Following the HTML specification, the order of events for
autoplaying media files (<video autoplay>) has been corrected:
- carplay, canplaythrough, play, playing

https://html.spec.whatwg.org/multipage/#ready-states:event-media-canplaythrough

WhatWG PR: whatwg/html#1409

Signed-off-by: Andrei Volykhin <[email protected]>
@tharkum
Copy link
Copy Markdown
Contributor Author

tharkum commented Nov 13, 2025

WPT live status

@jdm
Copy link
Copy Markdown
Contributor

jdm commented Nov 14, 2025

What are the expected results of the browsers after changing the test this way? Is Webkit the only engine that implements the specification order right now?

@tharkum
Copy link
Copy Markdown
Contributor Author

tharkum commented Nov 14, 2025

What are the expected results of the browsers after changing the test this way? Is Webkit the only engine that implements the specification order right now?

The expected order of the events for autoplay media is according to specification:

  • canplay, canplaythrough, play, playing

The most of major browsers doesn't follow the specification (except Safari, but it has another issue which is affecting final results)

Chromium:

  • canplay, play, playing, canplaythrough (see here)

The expected results after changing the test: 10/10 -> 6/10

Firefox:

  • canplay, play, playing, canplaythrough (see here)

The expected results after changing the test: 10/10 -> 6/10

Safari:

  • canplay, canplaythrough, play (missing), playing (see here)

The expected results after changing the test: 4/10 -> 4/10 because the play event is missing in expected event order, so no changes in results, while canplaythrough event is on this place.

FAIL message: assert_array_equals: expected property 2 to be "play" but got "playing" (expected array ["canplay", "canplaythrough", "play"] got ["canplay", "canplaythrough", "playing"])

@tharkum
Copy link
Copy Markdown
Contributor Author

tharkum commented Nov 14, 2025

There was discussion about the event ordering - WICG/interventions#23 (comment)

@jdm
Copy link
Copy Markdown
Contributor

jdm commented Nov 14, 2025

Ok, changing the test to reflect the current specification seems like the right choice. Whether the specification should be changed to reflect the actual browser implementations is probably also worth a discussion somewhere else!

@jdm jdm merged commit 5f6bfca into web-platform-tests:master Nov 14, 2025
26 checks passed
@tharkum tharkum deleted the html-media-event-order-autoplay branch November 14, 2025 05:49
tharkum added a commit to tharkum/servo that referenced this pull request Nov 17, 2025
Follow the HTML specification, queue a media element task to fire
`canplaythrough` event in expected order (after `canplay`) on the
changing the ready state to `HAVE_ENOUGH_DATA` which align the
event ordering for non-autoplay and autoplay media.

See https://html.spec.whatwg.org/multipage/#ready-states%3Aevent-media-canplaythrough

The associated WPT PR: web-platform-tests/wpt#56014

Testing: Improvements in the following tests
- html/semantics/embedded-content/media-elements/ready-states/autoplay.html

Signed-off-by: Andrei Volykhin <[email protected]>
tharkum added a commit to tharkum/servo that referenced this pull request Nov 17, 2025
Follow the HTML specification, queue a media element task to fire
`canplaythrough` event in expected order (after `canplay`) on the
changing the ready state to `HAVE_ENOUGH_DATA` which align the
event ordering for non-autoplay and autoplay media.

See https://html.spec.whatwg.org/multipage/#ready-states%3Aevent-media-canplaythrough

The associated WPT PR: web-platform-tests/wpt#56014

Testing: Improvements in the following tests
- html/semantics/embedded-content/media-elements/ready-states/autoplay.html

Signed-off-by: Andrei Volykhin <[email protected]>
github-merge-queue bot pushed a commit to servo/servo that referenced this pull request Nov 17, 2025
…40685)

Follow the HTML specification, queue a media element task to fire
`canplaythrough` event in expected order (after `canplay`) on the
changing the ready state to `HAVE_ENOUGH_DATA` which align the event
ordering for non-autoplay and autoplay media.

See
https://html.spec.whatwg.org/multipage/#ready-states%3Aevent-media-canplaythrough

The associated WPT PR:
web-platform-tests/wpt#56014

Testing: Improvements in the following tests
-
html/semantics/embedded-content/media-elements/ready-states/autoplay.html

Signed-off-by: Andrei Volykhin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants