trying to launch a wmv file from within my script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PastorHank
Forum Contributor
Posts: 117
Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country

trying to launch a wmv file from within my script

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
PastorHank
Forum Contributor
Posts: 117
Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country

Post 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.
PastorHank
Forum Contributor
Posts: 117
Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country

Post by PastorHank »

Problem solved.
User avatar
The Phoenix
Forum Contributor
Posts: 294
Joined: Fri Oct 06, 2006 8:12 pm

Post by The Phoenix »

PastorHank wrote:Problem solved.
How?
PastorHank
Forum Contributor
Posts: 117
Joined: Sat Jun 03, 2006 7:58 am
Location: Texas Hill Country

Post 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
Post Reply