Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

303
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda