bonjour ,
voici un script php pour lire des videos wmv , mpg qui se trouve dans un repertoire nommee video a chaque video transferer il cree un menu avec le nom de la video ,le souci c'est le menu je prefere un menu deroulant mais je sait pas le coder , l'autres souci c'est qu'il n'affiche pas les videos ne les lit pas , aider moi merci
voici le code php pour lire les videos dans le fichiers VIDEOS du site :
<?php
//-----------------------------------------------------------------------------------------
// the variables you have to set
//-----------------------------------------------------------------------------------------
// width of the video
$width = 320;
// height of the video
$height = 240;
//-----------------------------------------------------------------------------------------
// rest of the php part
//-----------------------------------------------------------------------------------------
// autoscanning the wmv directory
@$d = dir("videos");
if ($d) {
while($entry=$d->read()) {
$entry = preg_replace("/ /","%20",$entry);
$pos = strpos(strtolower($entry), ".wmv");
if (!($pos === false)) {
$files[] = "videos/".$entry;
}
}
$d->close();
}
// getting the file from the url
if ($_GET['file']) { $file = $_GET['file']; } else { $file = 1; }
// extracting the name of the video
$p1 = strrpos($files[$file-1],"/") + 1;
$p2 = strpos($files[$file-1],".wmv");
$name = substr($files[$file-1],$p1,($p2-$p1));
//-----------------------------------------------------------------------------------------
// displaying the html page
//-----------------------------------------------------------------------------------------
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>wmv Player Playlist</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- Stye Sheet -->
<style type="text/css">
body { background-color: #eee66e; font:10px/16px verdana; color: black; }
a { color: black; }
a:hover { color: #cc0000; }
div { margin:20px; }
h1 { margin-left:15px; }
</style>
</head>
<body>
<!-- the wmv movie name -->
<div id="name">
<p align="center"><b><?=$name?></b></p>
</div>
<!-- the wmvplayer -->
<div id="player">
<p align="center">
<center>
</br><table border="1" cellpadding="0" cellspacing="0" bordercolor="#000000"> <tr>
<td VALIGN="middle" align="center">
<p align="center"><object id='MediaPlayer' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' width=349 height=200 standby="Loading...">
<param name='AudioStream' value='-1'>
<param name='AutoSize' value='0'>
<param name='AutoStart' value='true'>
<param name='AllowScan' value='-1'>
<param name='AllowChangeDisplaySize' value='-1'>
<param name='AutoRewind' value='true'>
<param name='ClickToPlay' value='0'>
<param name='DisplayBackColor' value='3'>
<param name='DisplayMode' value='-1'>
<param name='DisplaySize' value='0'>
<param name='Enabled' value='-1'>
<param name='PlayCount' value='1'>
<param name='PreviewMode' value='1'>
<param name='ShowCaptioning' value='0'>
<param name='ShowControls' value='true'>
<param name='ShowAudioControls' value='1'>
<param name='TransparentAtStart' value='0'>
<param name='Volume' value='5'>
<param name='Filename' value="<?=$files[$file-1]?>" >
<!--NETSCAPE PLUG-IN STARTS HERE-->
<div style="text-align: center;"><embed type='application/x-mplayer2' src="<?=$files[$file-1]?>" name='NSPlay' pluginspage='
http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=media&sba=plugin' showcontrols=1 showdisplay=0 showstatusbar=0 autostart=1 loop=1 width=349 height=200 >
</embed>
</object>
</td>
</tr>
</table>
<p>
</div>
<!-- the nwmvgation -->
<div id="nav">
<p align="center"><b>
<ul>
<? // php loop for printing all the links
for ($i=0; $i<=sizeof($files)-1; $i++) {
$p1 = strrpos($files[$i],"/") + 1;
$p2 = strpos($files[$i],".wmv");
$name = substr($files[$i],$p1,($p2-$p1));
echo " <li><a href=\"wmvplayer.php?file=".($i+1)."\">".$name."</a></li>\n";
} ?>
</ul>
</b></p>
</div>
</body>
</html>