0

I have Work with PHP project in which one php page has so many category wise videos display and play but what I want is :-

I play first video it will start play and after that i click on second , third videos then all of the videos are playing, i want to stop previous video when i click on second and stop second video when i click on third and so on like that.

<?php

include("admin/dbconn.php");

$sqlAdmin ="SELECT * FROM `tbl_videos` where video_category='$rows[0]'";
$exeAdmin = mysqli_query($conn,$sqlAdmin);

$administration="";
while($arr=mysqli_fetch_array($exeAdmin)){
            $video_link = $arr['video_link'];

            $newId = explode("?v=",$video_link);

echo $administration.="<iframe src='https://www.youtube.com/embed/$newId[1]' frameborder='0' allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>
";
}
?>
KUMAR
  • 1,993
  • 2
  • 9
  • 26

1 Answers1

1

Starting the different videos within the iframe is done on the client side and not server side and thus you will not be able to control the behaviour via PHP. You can, however, do it via Javascript. Have a look here for example Stop embedded youtube iframe?

Paddy
  • 54
  • 6