Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
¿Cómo puedo detener automáticamente los videos cuando reproduzco otro video en el sitio de laravel?

Estoy usando el iframe de YouTube para incrustar videos en mi sitio desarrollados con el marco php laravel. Quiero asegurarme de que automáticamente detenga otros videos cuando reproduzca un video. Estoy usando el siguiente código pero no lo estoy trabajando. ¡Alguien puede ayudarme por favor!

 <iframe id="youtube_player" class="yt_player_iframe" width="100%" height="350" src="https://www.youtube.com/embed/{{$post->video_link}}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> <script> $('.yt_player_iframe').each(function(){ this.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}', '*') }); </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Para pausar otros videos y reproducir el que se está haciendo clic actualmente, debe repetir cada uno y asegurarse de que no se esté reproduciendo.

He creado una función de muestra y puede solucionarla:

 // Function Argument takes the current player function pauseOthersYoutubes( currentPlayer ) { // Make Sure there is a current video working, if not don't proceed if (!currentPlayer) return; //Loop to make sure all players are stopped unless the current player for (var i = ytplayerList.length; i-- ;){ if( ytplayerList[i] && (ytplayerList[i] != currentPlayer) ){ ytplayerList[i].pauseVideo(); } } }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!