Results 1 to 6 of 6

Thread: php video player

  1. #1
    Join Date
    Jul 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default php video player

    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.
    Code:
        <!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>

  2. #2
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Idk but this line looks suspicious to me...
    Code:
    SRC="<?php "'$path' . '$file'" ?>"
    Thats the first thing, and that could be the reason...

  3. #3
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Try this:

    Code:
        <!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.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  4. #4
    Join Date
    Sep 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how does this work with the video?

    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

    Quote Originally Posted by thetestingsite View Post
    Try this:

    Code:
        <!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.

  5. #5
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello,

    I tried this code, it is just showing the structure, but it's not playing any video, please let me know what to do...?

    Thanks



    Quote Originally Posted by thetestingsite View Post
    Try this:

    Code:
        <!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.

  6. #6
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    It sounds like you don't actually have any videos at that path. Are you sure you're reffering tot the correct place for the file? Another issue cuold be with how you are handling the form itself. Could you possibly post an example of a path to a video you are using? That could help a lot.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •