New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Account for video.play()
failing in media capture test
#19024
Conversation
video.play(); | ||
video.onerror = this.unreached_func("video error"); | ||
const playPromise = video.play(); | ||
assert_false(video.paused, "video paused"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know <video>
at all. Wouldn't this report that it is paused until the promise resolves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API is a bit funny, the paused
attribute changes synchronously and a "play" event is queued right away. Later when it's actually playing a "playing" event is fired and the promise returned from video.play()
resolves.
This assert is to fail fast if the browser won't play but also doesn't return a promise. You could do without it, if you think it detracts from the purpose of the test.
const playPromise = video.play(); | ||
assert_false(video.paused, "video paused"); | ||
if (playPromise) { | ||
playPromise.catch(this.unreached_func("video.play() error")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And you aren't waiting for the promise, so I'm not sure what this change does to reduce the chance of failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to make sure that an unhandled promise rejection doesn't result in a harness error, but fails the test if it happens while it's running, and is ignored if it happens after, in which case probably the test failed already.
The failure reported at the link is for Could not the "failure" be prevented, or faile for the specific test, by testing for |
|
This often fails in Safari:
https://wpt.fyi/results/mediacapture-fromelement/capture.html?run_id=297370005&run_id=319850011&run_id=297350007&run_id=314120009&run_id=291640006&run_id=303100001&run_id=306790008&run_id=305230003&run_id=277400002&run_id=293380001