[BUG] cant run element.requestFullscreen() without user interaction #224

Open
opened 2020-04-24 14:50:11 -05:00 by saty9 · 2 comments
saty9 commented 2020-04-24 14:50:11 -05:00 (Migrated from github.com)

Platform

Operating system and version:
Ubuntu 18.04.4 LTS
(also reproduced on windows 10)
OBS Studio version:
installed using ubuntu store snap version 25.0.7 rev 1063

Expected Behavior

A page that runs videoelement.requestFullscreen() should have that element go fullscreen

Current Behavior

The action is blocked with the message:

'requestFullscreen' on 'Element': API can only be initiated by a user gesture.

Steps to Reproduce

https://jsfiddle.net/saty9/xpntf1qc/3/
Should have enough to reproduce a page with the same issue. I believe it cant be hosted from a local file for testing as that may bypass the restriction (I haven't checked this)

Additional information

The video is displaying data from a webrtc stream in my usecase

<!-- READ THIS FIRST --> <!-- The OBS Studio GitHub issue tracker is **ONLY** to be --> <!-- used for reporting Bugs that have replication steps. --> <!-- You can post Feature Requests here: https://ideas.obsproject.com/ --> <!-- Get help for Support Issues here: https://obsproject.com/help --> <!--- Provide a general summary of the issue in the Title above --> ## Platform <!-- Please fill out the following information about your bug report. --> <!-- If you are on Linux and installed using a package, please list the package type. --> Operating system and version: Ubuntu 18.04.4 LTS (also reproduced on windows 10) OBS Studio version: installed using ubuntu store snap version 25.0.7 rev 1063 ## Expected Behavior <!--- Tell us what should happen --> A page that runs videoelement.requestFullscreen() should have that element go fullscreen ## Current Behavior <!--- Tell us what happens instead of the expected behavior. --> <!--- Please include a log file here if possible. --> The action is blocked with the message: ``'requestFullscreen' on 'Element': API can only be initiated by a user gesture.`` ## Steps to Reproduce <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug. Include code to reproduce, if relevant. --> <!--- Screenshots and video are encouraged if applicable. --> https://jsfiddle.net/saty9/xpntf1qc/3/ Should have enough to reproduce a page with the same issue. I believe it cant be hosted from a local file for testing as that may bypass the restriction (I haven't checked this) ## Additional information <!--- Not obligatory, but provide any additional details or information --> <!--- that you feel might be relevant to the issue --> The video is displaying data from a webrtc stream in my usecase
dodgepong commented 2020-04-24 15:09:56 -05:00 (Migrated from github.com)

I suspect they are trying to fullscreen a video player, perhaps.

I suspect they are trying to fullscreen a video player, perhaps.
WizardCM commented 2021-06-16 00:57:07 -05:00 (Migrated from github.com)

After testing this myself, the behaviour is correct in terms of behaving like a web browser - that is, the fullscreen API fails if you have not yet interacted with the site, but succeeds if you have. I've confirmed Microsoft Edge 91 does the same thing as obs-browser.

I can however see a use case for potentially sending a dummy interaction on load to make the page think a user has interacted with it, to allow for APIs such as this to succeed without actual user interaction (via the Interact dialog). The downside of doing this is there are certain APIs that shouldn't be run without actual user interaction.

After testing this myself, the behaviour is correct in terms of behaving like a web browser - that is, the fullscreen API fails if you have not yet interacted with the site, but succeeds if you have. I've confirmed Microsoft Edge 91 does the same thing as obs-browser. I can however see a use case for potentially sending a dummy interaction on load to make the page think a user has interacted with it, to allow for APIs such as this to succeed without actual user interaction (via the Interact dialog). The downside of doing this is there are certain APIs that *shouldn't* be run without actual user interaction.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-obsproject/obs-browser#224
No description provided.