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

239
Visualizações
In the Safari browser, the script restarts, but does not play video on the event

Got bumped with a problem, maybe someone can help me with it.

There is a script that should restart and play a video on an event ( play video.play(); ). On other browsers like Chrome etc. it works, except Safari.

On Safari it just resets the video to 0, but doesn't play it.

Seems like video.play() doesn't work on that browser.

Autoplay and mured are on.

Has anyone had this problem?

Here is the website https://luna-wealth-3b31bac5f1f8e980696881bf9d5.webflow.io/client-online-access

<script>
  window.addEventListener('DOMContentLoaded', function () {

    const video = document.getElementById("573dfe8f-6592-57e6-c48c-8e93fbdae2e3-video");
    const trigger = document.getElementById("trigger");
    const observerVideo = new IntersectionObserver((entries) => {
      if (entries[0].isIntersecting) {
        if (video.currentTime === 0) {
          video.muted = true;
          video.play();
        }
      }
    }, { threshold: 1 });

    const observerTrigger = new IntersectionObserver((entries) => {
      if (entries[0].isIntersecting) {
        if (video.currentTime !== 0) {
          video.currentTime = 0
        }
      }
    }, { threshold: 0 });

    observerTrigger.observe(trigger);
    observerVideo.observe(video);
  })
</script>
almost 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The problem was solved this way. We removed the 100% width parameter from the video and set the container that contains the video to flex justify-center. And the script started playing the video on Safari correctly.

At some resolutions the video stretched beyond its real resolution and Safari did not want to replay it in the event...

Of course it was strange, but it worked =)

almost 4 years ago · Santiago Trujillo 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