PDA

View Full Version : php video player


resnostyle
12-08-2007, 05:05 PM
i am working on a bit of code that will play an embedded video.
this is what i have currently.

when i select a movie my selection does continue and the movie doesnt start.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$showForm = 1;

if(isset($_POST['Submit'])) {

$showForm = 0;

?>

<OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=42
CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject">

<PARAM NAME="<?php $file ?>FileName" VALUE="<?php "'$path' . '$file'"?>">
<EMBED TYPE="application/x-mplayer2"
SRC="<?php "'$path' . '$file'" ?>"
NAME="MediaPlayer"
WIDTH=320
HEIGHT=42>
</EMBED>
</OBJECT>


<?php


}

if ($showForm == 1) {


//define the path as relative
$path = "movies/";

//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo "Directory Listing of $path<br/>";

//running the while loop
echo"<select>";
while ($file = readdir($dir_handle))
{
if($file!="." && $file!="..")
echo " <option value='$file'>$file</option>";
}
echo"</select>";

//closing the directory
closedir($dir_handle);

echo "<form action='".$_SERVER['php_self']."' method='post' >";

$_POST[$file];

echo" <button type=\"submit\" name=\"Submit\" value=\"0\">Push Me</button>";
echo" <input type=\"submit\" />";
echo"</form>";
}
?>
</body>
</html>

Rockonmetal
12-08-2007, 08:56 PM
Idk but this line looks suspicious to me...
SRC="<?php "'$path' . '$file'" ?>"
Thats the first thing, and that could be the reason...

thetestingsite
12-08-2007, 09:17 PM
Try this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$path = "movies/";
$showForm = 1;

if(isset($_POST['Submit'])) {

$showForm = 0;

?>

<OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=42
CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject">

<PARAM NAME="movie" VALUE="<?php echo $path.'/'.$_POST['file']; ?>">
<EMBED TYPE="application/x-mplayer2"
SRC="<?php echo $path.'/'.$_POST['file']; ?>"
NAME="MediaPlayer"
WIDTH=320
HEIGHT=42>
</EMBED>
</OBJECT>

<?php
}

if ($showForm == 1) {


//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo 'Directory Listing of $path<br>';

echo '<form action=" ' . $_SERVER['php_self'] . ' " method="post">';

//running the while loop
echo '<select name="file">';
while ($file = readdir($dir_handle))
{
if($file!="." && $file!="..")
echo '<option>' . $file . '</option>';
}
echo '</select>';

//closing the directory
closedir($dir_handle);

echo '<input type="submit" name="Submit" value="Push Me">';
echo '</form>';
}
?>
</body>
</html>


Hope this helps.

jaminconn
09-01-2011, 06:19 AM
please excuse me but I don't know how to get the video into this equasion. I'm somewhat new to PHP but I'm building elements here and there and learning as I go on some projects. I'd like to host my own videos for my demo reel in my own server space and build a rad embedded video playback page for each video that I have to host locally. this looks like the right direction but I don't know how to anchor the video to it. please excuse the newbe request. thnks

Try this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$path = "movies/";
$showForm = 1;

if(isset($_POST['Submit'])) {

$showForm = 0;

?>

<OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=42
CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject">

<PARAM NAME="movie" VALUE="<?php echo $path.'/'.$_POST['file']; ?>">
<EMBED TYPE="application/x-mplayer2"
SRC="<?php echo $path.'/'.$_POST['file']; ?>"
NAME="MediaPlayer"
WIDTH=320
HEIGHT=42>
</EMBED>
</OBJECT>

<?php
}

if ($showForm == 1) {


//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo 'Directory Listing of $path<br>';

echo '<form action=" ' . $_SERVER['php_self'] . ' " method="post">';

//running the while loop
echo '<select name="file">';
while ($file = readdir($dir_handle))
{
if($file!="." && $file!="..")
echo '<option>' . $file . '</option>';
}
echo '</select>';

//closing the directory
closedir($dir_handle);

echo '<input type="submit" name="Submit" value="Push Me">';
echo '</form>';
}
?>
</body>
</html>


Hope this helps.