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
https://forums.phpfreaks.com/topic/194812-embedded-video-player/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.