Playing multiple videos on the same player using html and php -


i have code playing multiple videos in single folder don't know error is

page1.php

<html> <body> <head> <title>video tests</title> </head> <h5>video list: </h5> <ul> <?php  $filelist = scandir("videolibrary"); foreach($filelist $key=>$video){     if($key >1){         echo '<li><a href="page2.php?video='.$key.'" >'.$video.'</a </li>';     } } ?> </ul> </br> </body> </html> 

page2.php

<html> <body> <?php  $current_video = $_get['video']; $filelist = scandir("videolibrary"); foreach($filelist $key=>$video){     if($key >1){         if($key==$current_video){             $current_video_src = $video;             $next_video = $key+1;             $previous_video = $key-1;         }     } } ?> <center> <video id="myvideo" width="720" height="480" controls autoplay> <source src="videolibrary/<?php echo $current_video_src; ?>" type="video/mp4"> </video> <a href="page2.php?video=<?php echo $previous_video; ?>" >previous</a> <a href="page2.php?video=<?php echo $next_video; ?>" >next</a> </center> </body> </html> 

looking forward have updated code, opening second page video isn't playing

here full code want do.

page1.php

<html> <body> <head> <title>video tests</title> </head> <h5>video list: </h5> <ul> <?php      $filelist = scandir("videolibrary");     foreach($filelist $key=>$video){         if($key >1){             echo '<li><a href="page2.php?video='.$key.'" >'.$video.'</a></li>';         }     } ?> </ul> </br> </body> </html> 

page2.php

<html> <body> <?php      $current_video = $_get['video'];     $filelist = scandir("videolibrary");     foreach($filelist $key=>$video){         if($key >1){             if($key==$current_video){                 $current_video_src = $video;                 $next_video = $key+1;                 $previous_video = $key-1;             }         }     } ?> <center> <video id="myvideo" width="720" height="480" controls autoplay>     <source src="videolibrary/<?php echo $current_video_src; ?>" type="video/mp4"> </video> <a href="page2.php?video=<?php echo $previous_video; ?>" >previous</a> <a href="page2.php?video=<?php echo $next_video; ?>" >next</a> </center> </body> </html> 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -