Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

300
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda