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

147
Visualizações
How to Set variable While Capturing the ESC event when exiting full screen mode?

I need to set variables while exiting the full-screen mode.

  myvariable = false
  @HostListener("dblclick", ['$event'])
  fullScreen(event) {
    console.log("fullScreen()",event)
    if(this.video)
    {
      if (this.video.requestFullscreen) {
        this.video.requestFullscreen();
      } else if (this.video.mozRequestFullScreen) {
        this.video.nativeElement.mozRequestFullScreen();
      } else if (this.video.webkitRequestFullscreen) {
        this.video.webkitRequestFullscreen();
      } else if (this.video.msRequestFullscreen) {
        this.video.msRequestFullscreen();
      }
    }
    if (document.addEventListener) {
      document.addEventListener('webkitfullscreenchange', this.exitHandler);
      document.addEventListener('mozfullscreenchange', this.exitHandler);
      document.addEventListener('fullscreenchange', this.exitHandler);
      document.addEventListener('MSFullscreenChange', this.exitHandler);
  }
    if (document.fullscreenElement) {
      this.myvariable = false
      document.exitFullscreen();
    }
  }
  exitHandler() {
    //this function is called whenever fullscreen and exit the fullscreen mode
    console.log("exitHandler : ",document.fullscreenElement,this.myvariable) // Here it's said undefined in this whole DOM found
    if (document.fullscreenElement === null) {
        this.myvariable = true
    }
  }

Is there anyone know? how to restrict the ESC key or how to set the variable in exitHandler() I tried to restrict ESC using keydown, keypress and keydown But did not capture the event while I am in Video FullScreen Mode and press the ESC key. I tried many ways but had no luck.

about 4 years ago · Juan Pablo Isaza
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