Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
reveal.js : cannot request full screen on video element (Firefox, Chromium)

While I can run the plain Mozilla example for putting a HTML5 video element into fullscreen based on key press, reveal.js must be doing something different or asynchronous regarding keypresses. When I try to do this using Reveal.configure({ keyboard: { 116: putVideoInFullScreen }}), Firefox (78) just complains:

Request for fullscreen was denied because Element.requestFullscreen() was not called from inside a short running user-generated event handler.

Similarly, in Chromium:

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

Frankly, I don't understand why pressing a key is not a user gesture. I looked into the reveal.js source code, and it all seems to go straight through a registered keypress event handler.

A work-around using directly registered handler, like document.addEventListener("keypress", handleKeyPress, false) does not work either, because reveal.js "blocks" the events that were registered before, so even if I have Reveal.configure({ keyboard: { 116: null }}), the event handler doesn't receive the F5 press. Catch-22.

Can I force FF to allow me to put fullscreen in any case? How can I make this work?


Note that my FF screen is already in full-screen. What I want to do is toggle full screen for a video element, like

var sl = Reveal.getCurrentSlide();
var e = sl.getElementsByTagName("video")[0];
if (typeof e !== 'undefined') {
  if (e.paused) {
    e.play();
    e.requestFullscreen(); // !!!
} else {
  e.pause();
  document.exitFullscreen();
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

A work-around for Firefox is to disable the check, as stated here: In about:config set full-screen-api.allow-trusted-requests-only to false.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!