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

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

Open
saty9 opened this issue Apr 24, 2020 · 4 comments
Open

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

saty9 opened this issue Apr 24, 2020 · 4 comments

Comments

@saty9
Copy link

saty9 commented Apr 24, 2020

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

@from-the-river-to-the-sea

Can you elaborate on what the use case for the fullscreen API is in a browser source? I admit I don't even know what invoking fullscreen would do on a webpage loaded in this way. What does it let you achieve that other APIs don't in this context?

@dodgepong
Copy link
Member

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

@from-the-river-to-the-sea

I agree that's a likely scenario. It should be noted that, in the context of a browser source, a visually similar outcome can be reached via something like:

video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%
}

That said, I can't immediately think of any security reasons for not allowing the fullscreen API to be freely invoked in a browser source, and obs-browser already makes a similar exception for the general media playback permissions: #105

@WizardCM
Copy link
Member

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants