Jump to content

Embedded video player


captain_scarlet87

Recommended Posts

Hi,

 

I've got this code whereby it will display all the .flv files in a folder as links to download. I was just wondering if anyone can help me link this to an embedded video player I have got, so that when the link is clicked it will go to the page whereby the video will play. I basically need the location of the file to pass over to the player instead of the static link currently there if that makes any sense? Thanks.

 

Displays all .flv files:

 

<?php
  $current_dir = "includes/videos/";    // Location to read files from.
  $dir = opendir($current_dir);        // Opens the directory.

  echo ("<p><h1>Video Tutorials:</h1></p><hr><br />");
  while ($file = readdir($dir))            // while loop
    {
    $parts = explode(".", $file);                    // pull apart the name and dissect by period
    if (is_array($parts) && count($parts) > 1) {    // does the dissected array have more than one part
        $extension = end($parts);        // set to we can see last file extension
        if ($extension == "flv"){    // Set allowable file extensions.
             echo "<a href=\"$current_dir/$file\" target=\"_blank\"> $file </a><br />";    // Link to location of video.
        }
       }
    }
  echo "<hr><br />";
  closedir($dir);        // Close the directory.
?>
</body>
</html>

 

Embedded player:

 

<html>
<head>
    <title>Videos</title>
    <script src="flowplayer/example/flowplayer-3.1.4.min.js"></script>
</head>
<body>

<a
    href="includes/videos/testflash.flv"
    style="display:block;width:425px;height:300px;"
    id="player">
</a>

<script language="JavaScript">
    flowplayer("player", "flowplayer/flowplayer-3.1.5.swf");
</script>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.