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

153
Visualizações
How to assign the handler to the correct play button

Clicking a play button starts all videos that have been previously played - the stop button works and no video is playing when the play buttons are on display.

Starting the videos other than the one play button that was previously clicked is supposed to start, and the other videos are supposed to be stopped.

That is the bug that needs to be fixed.

Clicking one of the play buttons when videos are stopped should only start one video, not multiple videos.

To reproduce issue: Click on one play button, and the video loads.

Then Click on the X

Now click on a different play button and you will see, the video that was clicked on before is now playing, along with the video I just clicked on. So now there are 2 videos playing at the same time.


This code is run each time I create a new player.

I am assigning the handler to play the video to every play button which is why all the videos play at once.

How do I assign the handler to the correct play button for that player?

How would I find the specific play button I need?

Click Run, not update to test code.

Code: https://jsitor.com/EBO8gdOs0c

Backup copy: https://jsfiddle.net/5etxr1kg/

function createPlayHandler(player) {
    const playButtons = document.querySelectorAll(".thePlay");
    playButtons.forEach(function playButtonHandler(buttons) {
      buttons.addEventListener("click", function buttonClickHandler() {
        player.playVideo();
      });
    });
  }
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