Run Video File in browser

Reply

Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Run Video File in browser

 
0
  #1
Aug 8th, 2008
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.......
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: Run Video File in browser

 
-1
  #2
Aug 8th, 2008
Originally Posted by nil_gh_80 View 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.......


Some one help me with some code...........
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 171
Reputation: praveen_dusari is an unknown quantity at this point 
Solved Threads: 21
praveen_dusari's Avatar
praveen_dusari praveen_dusari is offline Offline
Junior Poster

Re: Run Video File in browser

 
0
  #3
Aug 8th, 2008
hi nil
checkout this code which will upload only avi,dat,mpg and wmv video files only create uplodedvideos in ur folder
  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. }
Failure is success if we learn from it
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: Run Video File in browser

 
0
  #4
Aug 8th, 2008
Originally Posted by praveen_dusari View Post
hi nil
checkout this code which will upload only avi,dat,mpg and wmv video files only create uplodedvideos in ur folder
  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
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 171
Reputation: praveen_dusari is an unknown quantity at this point 
Solved Threads: 21
praveen_dusari's Avatar
praveen_dusari praveen_dusari is offline Offline
Junior Poster

Re: Run Video File in browser

 
0
  #5
Aug 8th, 2008
hi,
here is the code for displaying videos for the code above
  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
Failure is success if we learn from it
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: Run Video File in browser

 
0
  #6
Aug 8th, 2008
Originally Posted by praveen_dusari View Post
hi,
here is the code for displaying videos for the code above
  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
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 171
Reputation: praveen_dusari is an unknown quantity at this point 
Solved Threads: 21
praveen_dusari's Avatar
praveen_dusari praveen_dusari is offline Offline
Junior Poster

Re: Run Video File in browser

 
0
  #7
Aug 8th, 2008
yes it will,check my code if any errors let us know
Failure is success if we learn from it
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 83
Reputation: ahmksssv is an unknown quantity at this point 
Solved Threads: 7
ahmksssv ahmksssv is offline Offline
Junior Poster in Training

Re: Run Video File in browser

 
0
  #8
Feb 19th, 2009
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..
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 213
Reputation: nikesh.yadav is an unknown quantity at this point 
Solved Threads: 17
nikesh.yadav's Avatar
nikesh.yadav nikesh.yadav is offline Offline
Posting Whiz in Training

Re: Run Video File in browser

 
0
  #9
Mar 20th, 2009
nice post
Help as an alias

I think programming is great................
Tour Travel weblink by me and about Tour ,
Go To My Home Page and I m in Webdevelopment.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 250
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 20
samarudge samarudge is offline Offline
Posting Whiz in Training

Re: Run Video File in browser

 
0
  #10
Mar 22nd, 2009
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)
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC