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
<?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');
?>
<?php if (get_sub_field('position') == 'left_video') { ?>
<div class="donationVideoFeature">
<div class="video-container">
<div class="playDiv">
<i class="fa fa-play" data-toggle="modal" data-target="#myModal-<?php echo $i;?>"></i>
</div>
<div class="modal" id="myModal-<?php echo $i;?>">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<?php echo $modal_video; ?>
</div>
</div>
</div>
</div>
</div>
<div class="donationVideoText p-5 ">
<h3 class="donation-title"><?php the_sub_field('titulli_video');?></h3>
<p class="donation-paragraph"><?php the_sub_field('paragrafi_video');?></p>
<button class="btn btn-lg donateBTN"><?php the_sub_field('butoni_video');?></button>
</div>
</div>
<?php } else { ?>
<div class="donationVideoFeature">
<div class="donationVideoText p-5 ">
<h3 class="donation-title"><?php the_sub_field('titulli_video');?></h3>
<p class="donation-paragraph"><?php the_sub_field('paragrafi_video');?></p>
<button class="btn btn-lg donateBTN"><?php the_sub_field('butoni_video');?></button>
</div>
<div class="video-container">
<div class="playDiv">
<i class="fa fa-play" data-toggle="modal" data-target="#myModal-<?php echo $i;?>"></i>
</div>
<div class="modal" id="myModal-<?php echo $i;?>">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<?php echo $modal_video; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php }$i++; // Increment the increment variable
endwhile;
//End the loop
else :
endif;
?>