Navigation Menu

Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

video.play();
video.onerror = this.unreached_func("video error");
const playPromise = video.play();
assert_false(video.paused, "video paused");
Copy link
Contributor

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?

Copy link
Member Author

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"));
Copy link
Contributor

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.

Copy link
Member Author

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.

@gsnedders gsnedders closed this Jan 24, 2020
@gsnedders gsnedders deleted the foolip/mediacapture-playPromise branch January 24, 2020 18:06
@gsnedders gsnedders restored the foolip/mediacapture-playPromise branch January 24, 2020 18:40
@Hexcles Hexcles reopened this Jan 24, 2020
@guest271314
Copy link
Contributor

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

The failure reported at the link is for captureStream(), which according to MDN https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/captureStream#Browser_compatibility is not supported by Safari?

Could not the "failure" be prevented, or faile for the specific test, by testing for "captureStream" being defined before, or in lieu of executing a method not defined on the prototype of that object at an implementation "captureStream" in HTMLMediaElement.prototype?

@guest271314
Copy link
Contributor

captureStream is not defined at Firefox either, which AFAICT is a WIP to remove moz prefix https://bugzilla.mozilla.org/show_bug.cgi?id=1541471.

@foolip foolip closed this Oct 11, 2022
@foolip foolip deleted the foolip/mediacapture-playPromise branch October 11, 2022 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants