P5.js: Fullscreen returns an error

Created on 13 Jul 2020  路  4Comments  路  Source: processing/p5.js

Most appropriate sub-area of p5.js?

  • [x] Core/Environment/Rendering

Details about the bug:

  • p5.js version: p5.js v1.0.0 February 29, 2020
  • Web browser and version: Firefox developer edition 79.0b6
  • Operating System: Linux (Ubuntu based)
  • Steps to reproduce this:

Just entering to the reference page https://p5js.org/reference/#/p5/fullscreen take a quick look at the code and click on the example's sketch, then what happens is not what is expected (at least not what I expected).

I'm not 100% sure of this but the description says:

If argument is given, sets the sketch to fullscreen or not based on the value of the argument. If no argument is given, returns the current fullscreen state. Note that due to browser restrictions this can only be called on user input, for example, on mouse press like the example below.

And what I experience is just the same effect than pressing f11, so it's not the sketch but the window what goes fullscreen. And the console also shows this error:

`

Uncaught (in promise) TypeError: Fullscreen request denied
`

bug

All 4 comments

Welcome! 馃憢 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

I tried to reproduce the bug, but wasn't able to in Google Chome 83.0.4103.116. I downloaded Firefox 79.0b7 and I was able to reproduce this bug.

The bug doesn't occur generally, but I was able to reproduce it by opening the Developer Tools / Console and focusing on it. If fullscreen() is called while being focused in the console, an error is thrown.

Uncaught (in promise) TypeError: Fullscreen request denied.

Additional information is also available as a warning,
Request for fullscreen was denied because requesting element is not in the currently focused tab.

maim-1594697509

I am not sure if your error was occurring due to the same reason or not.

Anyways, this seems to be occurring due to Firefox's Security and seems to be by design.

As far as the reference is concerned, (and I am not too sure about this), sketch refers to the whole document, and you are probably trying to fullscreen your canvas. I don't know if p5.js contains a function to fullscreen the canvas, but it can be implemented by using the Element.requestFullscreen() method.

Another reason fullscreen request can fail is if the request takes longer than 1000ms to finish (Firefox specifically). That can happen when you have a lot of tabs opened in your browser. I encounter this quite a bit on all kinds of site, including YouTube.

thanks !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oranyelik picture oranyelik  路  3Comments

kjhollen picture kjhollen  路  3Comments

kartikay-bagla picture kartikay-bagla  路  3Comments

Vbbab picture Vbbab  路  3Comments

ghost picture ghost  路  3Comments