Skip to content

Conversation

@tharkum
Copy link
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 <andrei.volykhin@gmail.com>
@tharkum
Copy link
Contributor Author

tharkum commented Nov 13, 2025

WPT live status

@jdm
Copy link
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
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
Contributor Author

tharkum commented Nov 14, 2025

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

@jdm
Copy link
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 <andrei.volykhin@gmail.com>
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 <andrei.volykhin@gmail.com>
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 <andrei.volykhin@gmail.com>
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