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
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">

Link to comment
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">

 

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

Link to comment
Share on other sites

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>");
}

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.