Guest User

Untitled

a guest
Nov 24th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. $tipos=array("webm","mp4","ogv","jpg");
  4. $dirActual=dirname(__FILE__);
  5. $videos=array();
  6.  
  7. foreach($tipos as $tipo){
  8.     foreach(scandir($dirActual.$tipo) as $archivo){
  9.         if($archivo!="." && $archivo!=".."){
  10.             $a=pathinfo($dirActual.$tipo.$archivo,PATHINFO_FILENAME)
  11.             $videos[$tipo][$a['filename']]=basename($archivo);
  12.            
  13.         }
  14.        
  15.     }
  16. }
  17.  
  18. foreach($videos['jpg'] as $poster){
  19. ?>
  20. <video id="<?php print $poster?>" width="800" height="450" poster="jpg/<?php print $poster?>" controls="controls" preload="none">
  21.     <source type="video/mp4" src="mp4/<?php print $poster?>.mp4" />
  22.     <source type="video/webm" src="webm/<?php print $poster?>.webm" />
  23.     <source type="video/ogg" src="ogv/<?php print $poster?>.ogv" />
  24. </video>
  25.  
  26. <?php
  27. }
  28.  
  29. ?>
Add Comment
Please, Sign In to add comment