943,600 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4906
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Aug 8th, 2008
0

Run Video File in browser

Expand Post »
I want to run video files in browser ...............

which format will be suitible for it..

and how to do this using HTML & PHP...

Need help.......
Similar Threads
Reputation Points: 8
Solved Threads: 2
Junior Poster in Training
nil_gh_80 is offline Offline
64 posts
since Aug 2007
Aug 8th, 2008
-1

Re: Run Video File in browser

Click to Expand / Collapse  Quote originally posted by nil_gh_80 ...
I want to run video files in browser ...............

which format will be suitible for it..

and how to do this using HTML & PHP...

Need help.......


Some one help me with some code...........
Reputation Points: 8
Solved Threads: 2
Junior Poster in Training
nil_gh_80 is offline Offline
64 posts
since Aug 2007
Aug 8th, 2008
0

Re: Run Video File in browser

hi nil
checkout this code which will upload only avi,dat,mpg and wmv video files only create uplodedvideos in ur folder
php Syntax (Toggle Plain Text)
  1. if($_SERVER['REQUEST_METHOD']=='POST')
  2. {
  3. if($HTTP_POST_FILES["video"]["size"] >1) { // for large image 1
  4. $ext = substr($HTTP_POST_FILES['video']['name'],strpos($HTTP_POST_FILES['video']['name'],'.')+1);
  5. $ext_arr=array("avi","dat","mpg","wmv");
  6. //if (in_array($ext,$ext_arr)) {
  7. $prlvideo=substr($HTTP_POST_FILES['video']['name'],0,strpos($HTTP_POST_FILES['video']['name'],'.'));
  8. $prlvideo.=time();
  9. $prlvideo.=strstr($HTTP_POST_FILES['video']['name'],'.');
  10. $prlvideo="uplodedvideos/".$prlvideo;
  11. if(!move_uploaded_file($HTTP_POST_FILES['video']['tmp_name'],$prlvideo)) { $prlvideo=""; }
  12. chmod($prlvideo,0777);
  13.  
  14. } else {
  15. $prlvideo="";
  16. }
  17.  
  18. $v = substr($HTTP_POST_FILES['video']['name'],strpos($HTTP_POST_FILES['video']['name'],'.')+1);
  19. if($v=='avi' || $v=='dat' || $v=='mpg' || $v=='wmv')
  20. {
  21.  
  22. $qry2="INSERT INTO vdo_cat(`c_name`,`videos`,`parent_id`)VALUES ('".$_POST['txtsubcategory']."','".$prlvideo."','".$_POST['selcategory']."')";
  23. $res2=mysql_query($qry2) or die(mysql_error()); if($res2==1)
  24. {
  25. header("location:manage_videos.php?msg=ad");
  26. }
  27. }
  28. else
  29. {
  30. $vmsg="You must upload only videos....";
  31.  
  32. }
  33.  
  34. }
Reputation Points: 21
Solved Threads: 29
Posting Whiz in Training
praveen_dusari is offline Offline
202 posts
since Jun 2008
Aug 8th, 2008
0

Re: Run Video File in browser

hi nil
checkout this code which will upload only avi,dat,mpg and wmv video files only create uplodedvideos in ur folder
php Syntax (Toggle Plain Text)
  1. if($_SERVER['REQUEST_METHOD']=='POST')
  2. {
  3. if($HTTP_POST_FILES["video"]["size"] >1) { // for large image 1
  4. $ext = substr($HTTP_POST_FILES['video']['name'],strpos($HTTP_POST_FILES['video']['name'],'.')+1);
  5. $ext_arr=array("avi","dat","mpg","wmv");
  6. //if (in_array($ext,$ext_arr)) {
  7. $prlvideo=substr($HTTP_POST_FILES['video']['name'],0,strpos($HTTP_POST_FILES['video']['name'],'.'));
  8. $prlvideo.=time();
  9. $prlvideo.=strstr($HTTP_POST_FILES['video']['name'],'.');
  10. $prlvideo="uplodedvideos/".$prlvideo;
  11. if(!move_uploaded_file($HTTP_POST_FILES['video']['tmp_name'],$prlvideo)) { $prlvideo=""; }
  12. chmod($prlvideo,0777);
  13.  
  14. } else {
  15. $prlvideo="";
  16. }
  17.  
  18. $v = substr($HTTP_POST_FILES['video']['name'],strpos($HTTP_POST_FILES['video']['name'],'.')+1);
  19. if($v=='avi' || $v=='dat' || $v=='mpg' || $v=='wmv')
  20. {
  21.  
  22. $qry2="INSERT INTO vdo_cat(`c_name`,`videos`,`parent_id`)VALUES ('".$_POST['txtsubcategory']."','".$prlvideo."','".$_POST['selcategory']."')";
  23. $res2=mysql_query($qry2) or die(mysql_error()); if($res2==1)
  24. {
  25. header("location:manage_videos.php?msg=ad");
  26. }
  27. }
  28. else
  29. {
  30. $vmsg="You must upload only videos....";
  31.  
  32. }
  33.  
  34. }



Thanx for ur attention...........But my problem is how to display uploaded videos in any browser using WM player
Reputation Points: 8
Solved Threads: 2
Junior Poster in Training
nil_gh_80 is offline Offline
64 posts
since Aug 2007
Aug 8th, 2008
0

Re: Run Video File in browser

hi,
here is the code for displaying videos for the code above
php Syntax (Toggle Plain Text)
  1. <?
  2. include_once('functions.php');
  3. include_once('conn.php');
  4. if(!empty($_GET['pid']))
  5. {
  6. $pqry="SELECT * FROM vdo_cat where c_id=".$_GET['pid'];
  7. $pres=mysql_query($pqry) or die(mysql_error());
  8. $prow=mysql_fetch_array($pres);
  9. $len=strrpos($prow['videos'],'.');
  10. $vtype=substr($prow['videos'],$len+1,5);
  11. echo $vname=($prow['videos']);
  12. if(isset($vtype))
  13. {
  14. ?>
  15. <html>
  16. <link href="site.css" rel="stylesheet" type="text/css" />
  17. <style type="text/css">
  18. <!--
  19. body {
  20. margin-left: 0px;
  21. margin-top: 0px;
  22. margin-right: 0px;
  23. margin-bottom: 0px;
  24. }
  25. -->
  26. </style>
  27. <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5)">
  28. <body>
  29. <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#83CBED">
  30. <tr>
  31. <td bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  32. <tr>
  33. <td>&nbsp;</td>
  34. </tr>
  35. <tr>
  36. <td align="center" valign="middle"><object id="MediaPlayer1" width="180" height="200"
  37. classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
  38. codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
  39. standby="Loading Microsoft® Windows® Media Player components..."
  40. type="application/x-oleobject" align="middle">
  41. <param name="FileName" value="video path/<?=$vname; ?>">
  42. <param name="ShowStatusBar" value="True">
  43. <param name="DefaultFrame" value="mainFrame">
  44. <param name="autostart" value="false">
  45. <embed type="application/x-mplayer2"
  46. pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/"
  47. src="../banjara_admin/videos/<?=$vname; ?>"
  48. autostart="false"
  49. align="middle"
  50. width="176"
  51. height="144"
  52. defaultframe="rightFrame"
  53. showstatusbar="true">
  54. </embed>
  55. </object>
  56. <a href="YourFilesName.mpeg"><font size="2">Clickhere for standalone player</font></a>
  57. <a href="http://www.microsoft.com/windows/windowsmedia/mp10/default.aspx">
  58. <font size="1">Download Windows Media Player Here</font></a></p></td>
  59. </tr>
  60. <tr>
  61. <td></td><? } }?>
  62. </tr>
  63. <tr>
  64. <td align="center" valign="middle"><a href="#" class="orngsml" onClick="javascript:window.close();" ><strong>Close</strong></a></td>
  65. </tr>
  66. </table></td>
  67. </tr>
  68. </table>
  69. </body>
  70. </html>
when user clicks on play videos will play in a window in my program (see above... 'pid' )
it worked fine for me
Reputation Points: 21
Solved Threads: 29
Posting Whiz in Training
praveen_dusari is offline Offline
202 posts
since Jun 2008
Aug 8th, 2008
0

Re: Run Video File in browser

hi,
here is the code for displaying videos for the code above
php Syntax (Toggle Plain Text)
  1. <?
  2. include_once('functions.php');
  3. include_once('conn.php');
  4. if(!empty($_GET['pid']))
  5. {
  6. $pqry="SELECT * FROM vdo_cat where c_id=".$_GET['pid'];
  7. $pres=mysql_query($pqry) or die(mysql_error());
  8. $prow=mysql_fetch_array($pres);
  9. $len=strrpos($prow['videos'],'.');
  10. $vtype=substr($prow['videos'],$len+1,5);
  11. echo $vname=($prow['videos']);
  12. if(isset($vtype))
  13. {
  14. ?>
  15. <html>
  16. <link href="site.css" rel="stylesheet" type="text/css" />
  17. <style type="text/css">
  18. <!--
  19. body {
  20. margin-left: 0px;
  21. margin-top: 0px;
  22. margin-right: 0px;
  23. margin-bottom: 0px;
  24. }
  25. -->
  26. </style>
  27. <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5)">
  28. <body>
  29. <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#83CBED">
  30. <tr>
  31. <td bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  32. <tr>
  33. <td>&nbsp;</td>
  34. </tr>
  35. <tr>
  36. <td align="center" valign="middle"><object id="MediaPlayer1" width="180" height="200"
  37. classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
  38. codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
  39. standby="Loading Microsoft® Windows® Media Player components..."
  40. type="application/x-oleobject" align="middle">
  41. <param name="FileName" value="video path/<?=$vname; ?>">
  42. <param name="ShowStatusBar" value="True">
  43. <param name="DefaultFrame" value="mainFrame">
  44. <param name="autostart" value="false">
  45. <embed type="application/x-mplayer2"
  46. pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/"
  47. src="../banjara_admin/videos/<?=$vname; ?>"
  48. autostart="false"
  49. align="middle"
  50. width="176"
  51. height="144"
  52. defaultframe="rightFrame"
  53. showstatusbar="true">
  54. </embed>
  55. </object>
  56. <a href="YourFilesName.mpeg"><font size="2">Clickhere for standalone player</font></a>
  57. <a href="http://www.microsoft.com/windows/windowsmedia/mp10/default.aspx">
  58. <font size="1">Download Windows Media Player Here</font></a></p></td>
  59. </tr>
  60. <tr>
  61. <td></td><? } }?>
  62. </tr>
  63. <tr>
  64. <td align="center" valign="middle"><a href="#" class="orngsml" onClick="javascript:window.close();" ><strong>Close</strong></a></td>
  65. </tr>
  66. </table></td>
  67. </tr>
  68. </table>
  69. </body>
  70. </html>
when user clicks on play videos will play in a window in my program (see above... 'pid' )
it worked fine for me




You have included function.php do this page compile without this file
Reputation Points: 8
Solved Threads: 2
Junior Poster in Training
nil_gh_80 is offline Offline
64 posts
since Aug 2007
Aug 8th, 2008
0

Re: Run Video File in browser

yes it will,check my code if any errors let us know
Reputation Points: 21
Solved Threads: 29
Posting Whiz in Training
praveen_dusari is offline Offline
202 posts
since Jun 2008
Feb 19th, 2009
0

Re: Run Video File in browser

Hi Praveen...

This is great....

I want some clarity about this video playing...

Can u send me the two php files with data base table....because the above two files are not matching with their column names...i am confusing....plz send me clearly with patiencs...

Thank u..
Reputation Points: 11
Solved Threads: 7
Junior Poster in Training
ahmksssv is offline Offline
84 posts
since Feb 2009
Mar 20th, 2009
0

Re: Run Video File in browser

nice post
Reputation Points: 15
Solved Threads: 21
Posting Whiz in Training
nikesh.yadav is offline Offline
219 posts
since Feb 2008
Mar 22nd, 2009
0

Re: Run Video File in browser

Why not just use FLV? its a lot simpler and will work in Firefox/Safari as well as IE
P.S. I know you can run WMP plugin in firefox but its an extra download you don't need (Not sure about Safari thoug)
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008
Message:
Previous Thread in PHP Forum Timeline: online self evaluation system
Next Thread in PHP Forum Timeline: password change in PHP on MySQL





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC