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

Media element's controls can create observable orphan Promises #10771

Open
Kaiido opened this issue Nov 17, 2024 · 1 comment
Open

Media element's controls can create observable orphan Promises #10771

Kaiido opened this issue Nov 17, 2024 · 1 comment
Labels
interop Implementations are not interoperable with each other topic: media

Comments

@Kaiido
Copy link
Member

Kaiido commented Nov 17, 2024

What is the issue with the HTML Standard?

In https://html.spec.whatwg.org/multipage/media.html#user-interface it is said

Where possible (specifically, for starting, stopping, pausing, and unpausing playback, for seeking, for changing the rate of playback, for fast-forwarding or rewinding, for listing, enabling, and disabling text tracks, and for muting or changing the volume of the audio), user interface features exposed by the user agent must be implemented in terms of the DOM API described above, so that, e.g., all the same events fire.

This means that e.g. clicking on the "play" button of a media element's controls UI, the play method should be called, so that all the events are fired.
However this method does return a Promise, which in this case is created out of the magical user interaction world and can't be acted upon from scripts. This becomes problematic when this Promise rejects, which is the case if the loading of the media is aborted. In this case, the rejected Promise will be observable in the unhandledrejection event, even though it didn't came from any script on the page. https://jsfiddle.net/aomxhpu6/

Currently only Firefox follows the specs here, while Chrome and Safari do not expose the rejected Promise, but I wonder if it wouldn't be better to lean on Chrome and Safari's behavior instead.

@Kaiido Kaiido added topic: media interop Implementations are not interoperable with each other labels Nov 17, 2024
@annevk
Copy link
Member

annevk commented Nov 18, 2024

cc @whatwg/media

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Implementations are not interoperable with each other topic: media
Development

No branches or pull requests

2 participants