Jump to content

Help!! how To Display Video Using PHP


Sean1989

Recommended Posts

Hey all i wondered if you could help me, im trying to get a video file to display if there is one using this code:

 

 

$dir = "files/video/" .$review['topic_id'] . "/";

$files = array();

if(is_dir($dir)){  

//Handle files

    $handle = opendir($dir);

    while($this_file = readdir($handle)){

	if(is_file($dir . $this_file)){

		$ext = strtolower(substr($this_file,-1));

		if($ext == ".wmv"){

		    $files[] = $dir . $this_file;				

		}



        }

}

    closedir ($handle);

}



sort($files); //Alphabetise files

$total_files = count($files);



if($total_files !== 0){

print("<h2>Video</h2>\n");



//List Video
print("<!--Video-->\n");

for($i = 0; $i < $total_files; $i++){

	print("<a>video</a>");

}

print("<br clear=\"all\">");


}

 

I want it to either display the video as a link, or preferable actually display on the page as a plugin using this code:

 

<OBJECT id='mediaPlayer' width="384" height="333" 
      classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' 
      codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
      standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>
      <param name='fileName' value="http://eggynews.byethost18.com/files/video/22.wmv">
      <param name='animationatStart' value='true'>
      <param name='transparentatStart' value='true'>
      <param name='autoStart' value="false">
      <param name='showControls' value="true">
      <param name='loop' value="true">
      <EMBED type='application/x-mplayer2'
        pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
        id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1' 
        bgcolor='darkblue' showcontrols="true" showtracker='-1' 
        showdisplay='0' showstatusbar='-1' videoborder3d='-1' width="384" height="333"
        src="http://eggynews.byethost18.com/files/video/22.wmv" autostart="true" designtimesp='5311' loop="true">
      </EMBED>
      </OBJECT>

      <!-- ...end embedded WindowsMedia file -->
    <!-- begin link to launch external media player... -->
        <tr><td align='center'>
        <a href="http://eggynews.byethost18.com/files/video/22.wmv" style='font-size: 85%;' target='_blank'>Launch in external player</a>
        <!-- ...end link to launch external media player... -->

 

hope someone can help

 

Thanks In Advance

 

Seán

Link to comment
https://forums.phpfreaks.com/topic/44762-help-how-to-display-video-using-php/
Share on other sites

umm..

<embed src="http://www.site.com/flvplayer.swf" bgcolor="#FFFFFF" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="file=http://www.site.co.za/flvideos/vidoe.flv&showdigits=true&autostart=true&bufferlength=10" height="370" width="450">

umm..

<embed src="http://www.site.com/flvplayer.swf" bgcolor="#FFFFFF" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="file=http://www.site.co.za/flvideos/vidoe.flv&showdigits=true&autostart=true&bufferlength=10" height="370" width="450">

 

Im using a .wmv file though, how would it code then?

I've got this so far...

 

if(is_file("files/videos/" . $review['topic_id'] . ".wmv")){
    print("<EMBED type='application/x-mplayer2'
        pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
        id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1' 
        bgcolor='darkblue' showcontrols="true" showtracker='-1' 
        showdisplay='0' showstatusbar='-1' videoborder3d='-1' width="384" height="333"
        src=" . $files[$i] . "\">"" autostart="true" designtimesp='5311' loop="true">
      </EMBED>");
}

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.