Page 1 of 1

trying to launch a wmv file from within my script

Posted: Sun Sep 02, 2007 8:29 pm
by PastorHank
Sorry for the incomplete posting

Anyway, I am trying to launch a windows media file from within my script. I've googled it and I'm probably not using the correct phrases, but I can't find any help.
Below is code I have tried

Code: Select all

$row = mysql_fetch_array($result1);
  	extract($row);
 
	$movietoshow=stripslashes($movietitle);
	$pathtomovie="../movies/";
	$finalpathtomovie=$pathtomovie.$movietoshow;
/*  var_dump shows the correct file name and path */
/*  permissions are 755 on directory */
#

/*  functions tried */
/*	exec('$finalpathtomovie'); */
/*	exec($finalpathtomovie); */
/*	passthru('$finalpathtomovie');*/
/*	passthru($finalpathtomovie);*/
/* The above return the correct file path, but nothing happens */
	fopen('$finalpathtomovie',"r");
/* fopen returns file not found */
Thank you

Posted: Sun Sep 02, 2007 11:58 pm
by s.dot
Are you trying to launch it in the browser through windows media player, or into windows media player itself, where windows media player opens up?

Posted: Mon Sep 03, 2007 6:52 am
by PastorHank
Great question, which I hadn't really thought about. I guess I'm just trying to get windows media player to just play it outside of the browser. Although I'd love for the video to be inside a page and played that way.

Posted: Mon Sep 03, 2007 2:54 pm
by PastorHank
Problem solved.

Posted: Mon Sep 03, 2007 2:56 pm
by The Phoenix
PastorHank wrote:Problem solved.
How?

Posted: Mon Sep 03, 2007 3:39 pm
by PastorHank
The issue is not a php issue. It was the windows media player object. That has to be activated in the code and I had neglected to do so (well actually I had no idea I had to do so, but..) the question asked about if I was trying to imbed or run outside got me thinking about the object. And that lead to the html code needed.

Code: Select all

$row = mysql_fetch_array($result1);
  	extract($row);
 	$movietoshow=$movietitle;
	$finalpathtomovie=$pathtomovie.$movietoshow;
	
 echo "<table align='center' border='0' cellpadding='0' align='left'>";
 echo "<tr>\n
	 		<td</td>
		</tr>";
 echo "<tr>\n
	 		<td align='center'>$pagetitleinfo</td>
</tr>";
echo "<tr>\n
	 		<td</td>
		</tr>";
  
 echo "<tr>\n
	<td align='center'><b><input style=background-color:'#DEB887' name='animal_id' READONLY value=\"".htmlspecialchars($animalid)."\"></b></td>
</tr>";
 
/* begin embedded WindowsMedia file... */
 echo "<tr>\n
 		<td>
	      <OBJECT id='mediaPlayer' width='320' height='285' 
      		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='$finalpathtomovie'>

      		<param name='animationatStart' value='true'>
    		 <param name='transparentatStart' value='true'>
   		   <param name='autoStart' value='true'>
	      <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='0' 
	        bgcolor='darkblue' showcontrols='true' showtracker='-1' 
       		 showdisplay='1' showstatusbar='-1' videoborder3d='-1' width='320' height='285'
   	     src='$finalpathtomovie' autostart='true' designtimesp='5311' loop='false'>
  	    </EMBED>
 	     </OBJECT>
 	     </td>
 	     </tr>";
/*      <!-- ...end embedded WindowsMedia file --> */
/*        <!-- begin link to launch external media player... --> */
 echo "<tr>\n
 <td align='center'>
        <a href='$finalpathtomovie' style='font-size: 85%;' target='_blank'>Launch in external player</a>
        </td>
        </tr>";

 echo "</table>\n";
And now it works