title: How to stop the video from playing after modul is closed (ACF)?
body: <p>i have a problem and i dont know how to fix it. I have a acf repeater, and a video repeater on it from youtube, when i click a button to open the video, the video is opened as a modal, but when i close the modal, the video keep still playing in background
  How to stop video from playing after the modal has been closed?
  Thanks</p>
  <pre><code>&lt;?php if( have_rows('video_youtube1') ):
  $i = 1; // Set the increment variable
  // loop through the rows of data
  while ( have_rows('video_youtube1') ) : the_row();
      $modal_video = get_sub_field('video');
      $modal_header = get_sub_field('titulli_video');
      $modal_body = get_sub_field('paragrafi_video');
      $modal_footer = get_sub_field('butoni_video');
  ?&gt;
      &lt;?php if (get_sub_field('position') == 'left_video') { ?&gt;
          &lt;div class=&quot;donationVideoFeature&quot;&gt;
              &lt;div class=&quot;video-container&quot;&gt;
              &lt;div class=&quot;playDiv&quot;&gt;
                      &lt;i class=&quot;fa fa-play&quot; data-toggle=&quot;modal&quot; data-target=&quot;#myModal-&lt;?php echo $i;?&gt;&quot;&gt;&lt;/i&gt;
              &lt;/div&gt;
                  &lt;div class=&quot;modal&quot; id=&quot;myModal-&lt;?php echo $i;?&gt;&quot;&gt;
                      &lt;div class=&quot;modal-dialog&quot;&gt;
                          &lt;div class=&quot;modal-content&quot;&gt;
                              &lt;div class=&quot;modal-header&quot;&gt;
                                  &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;modal&quot;&gt;×&lt;/button&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;modal-body&quot;&gt;
                                  &lt;?php echo $modal_video; ?&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class=&quot;donationVideoText p-5 &quot;&gt;
                  &lt;h3 class=&quot;donation-title&quot;&gt;&lt;?php the_sub_field('titulli_video');?&gt;&lt;/h3&gt;
                  &lt;p class=&quot;donation-paragraph&quot;&gt;&lt;?php the_sub_field('paragrafi_video');?&gt;&lt;/p&gt;
                  &lt;button class=&quot;btn btn-lg donateBTN&quot;&gt;&lt;?php the_sub_field('butoni_video');?&gt;&lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
      &lt;?php } else { ?&gt;
  
          &lt;div class=&quot;donationVideoFeature&quot;&gt;
              &lt;div class=&quot;donationVideoText p-5 &quot;&gt;
                  &lt;h3 class=&quot;donation-title&quot;&gt;&lt;?php the_sub_field('titulli_video');?&gt;&lt;/h3&gt;
                  &lt;p class=&quot;donation-paragraph&quot;&gt;&lt;?php the_sub_field('paragrafi_video');?&gt;&lt;/p&gt;
                  &lt;button class=&quot;btn btn-lg donateBTN&quot;&gt;&lt;?php the_sub_field('butoni_video');?&gt;&lt;/button&gt;
              &lt;/div&gt;
              &lt;div class=&quot;video-container&quot;&gt;
              &lt;div class=&quot;playDiv&quot;&gt;
                      &lt;i class=&quot;fa fa-play&quot; data-toggle=&quot;modal&quot; data-target=&quot;#myModal-&lt;?php echo $i;?&gt;&quot;&gt;&lt;/i&gt;
              &lt;/div&gt;
                  &lt;div class=&quot;modal&quot; id=&quot;myModal-&lt;?php echo $i;?&gt;&quot;&gt;
                      &lt;div class=&quot;modal-dialog&quot;&gt;
                          &lt;div class=&quot;modal-content&quot;&gt;
                              &lt;div class=&quot;modal-header&quot;&gt;
                                  &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;modal&quot;&gt;×&lt;/button&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;modal-body&quot;&gt;
                                  &lt;?php echo $modal_video; ?&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;?php   }$i++; // Increment the increment variable
  
  endwhile; 
  //End the loop 
  else : 
  endif; 
  ?&gt;
  </code></pre>