Bug 234976 - webkitRequestFullscreen fulfils but will not go into fullscreen with click handler that creates MediaStream and plays video
Summary: webkitRequestFullscreen fulfils but will not go into fullscreen with click ha...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-07 11:57 PST by Will Morgan
Modified: 2022-01-10 09:48 PST (History)
7 users (show)

See Also:


Attachments
fs.html testbed (2.29 KB, text/plain)
2022-01-07 11:57 PST, Will Morgan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Will Morgan 2022-01-07 11:57:56 PST
Created attachment 448616 [details]
fs.html testbed

When I click a button that creates a MediaStream with getUserMedia, then plays a video that satisfies the autoplay criteria, then performs webkitRequestFullscreen (WRFS), the WRFS call return but no fullscreen resize event happens.

For compatibility with other browsers, especially with regard to anti-abuse and user activation, the advice is to first getUserMedia, then play a video, then finally requestFullscreen. This is because requestFullscreen clears user activation flags, which means that you can't getUserMedia afterwards.

This is the approach suggested here: https://github.com/whatwg/fullscreen/issues/152#issuecomment-494840412

My expected behaviour here would be for webkitRequestFullscreen to actually go into fullscreen, or at the very minimum if the WebKit team disagree with the WHATWG user activation approach, it should at least throw with a NotAllowedError.

This has downstream implications - sindresorhus's screenfull library returns a promise that never fulfils because WRFS doesn't throw and no change events happen. This effectively deadlocks any application that relies on entering fullscreen unless an arbitrary timeout is used.

I'm discussing the same issue with the team at Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=957558
Comment 1 Mark B 2022-01-10 00:24:17 PST
Is this issue common to macOS and iOS?
And is it new in Safari 15? Are all minor versions affected?
We would also appreciate feedback on whether the current behaviour is intended, and if so some guidance around avoiding the described deadlock.
If not, is a fix already in the pipeline?
Comment 2 Radar WebKit Bug Importer 2022-01-10 09:48:31 PST
<rdar://problem/87346180>