Datenshi Posted May 16, 2007 Share Posted May 16, 2007 Im having kinda annoying problems with my code atm, Im trying to make a private video clip site and ive put all the videos inside mysql like this: Table videos `id` int(11) unsigned NOT NULL auto_increment, `path` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, PRIMARY KEY (`id`) Typical entry could be id= 1 path = ..videos/mymovie.avi name= Tiz.Is.Da.Movie My PHP script works like its requesting all the entries in the database and puts a link with each "name" of the file. The link leads to, for example www.myaddress.com/film.php?id=1&fixit=.avi I have to add the extension since Divx Web Player refuse to play urls which doesnt have a .divx/.avi extension. Ah well, once i click a link Divx Web Player opens a file called film.php in an iframe, so far so good...until it tries to connect to the url specified in the embed code for the Web Player.. Code looks like this: <embed type="video/divx" src="<?php echo $result['path']; ?>" Its suppose to input for example "..videos/mymovie.avi" into the src value but i dont know if it does coz the clips aint playing. Anyone able to shed some light over this? Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/ Share on other sites More sharing options...
phast1 Posted May 16, 2007 Share Posted May 16, 2007 Can you do a "View Source" on the browser when the clip doesn't play and verify if the <embed> line was filled in properly or not? This would definitely help to narrow down the problem.. Also note that browsers cannot play DIVX files without extra software (plugin) being installed.. So, I think you would need to add pluginspage="http://go.divx.com/plugin/download/" to your <embed> statement.. Like this: <embed type="video/divx" src="<?php echo $result['path']; ?>" pluginspage="http://go.divx.com/plugin/download/"> That should cause the browser to prompt the user to download the plugin before playing it.. It also wouldn't hurt to specify the height and width of your movie, such as: <embed type="video/divx" src="<?php echo $result['path']; ?>" pluginspage="http://go.divx.com/plugin/download/" height="200" width="300"> Hope that helps! Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-254172 Share on other sites More sharing options...
Datenshi Posted May 16, 2007 Author Share Posted May 16, 2007 Thx for answering, since its PHP code within the tag embed src="HERE" im unable to see if it loaded properly, it just says embed src="" . Also there's more to the code as you described but i didnt feel it nessesary to write that stuff down, thx for telling me tho incase Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-254245 Share on other sites More sharing options...
phast1 Posted May 16, 2007 Share Posted May 16, 2007 If you did a view source and just see embed src="", then that means that your PHP code did not work as expected.. I'm not sure how you populated the $result variable, but that is most likely where the problem is, or it could be a problem with your mySQL query that caused no results to be returned.. If you can post the PHP code that is responsible for doing the database query and filling the $result array, then we should be able to help more.. Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-254642 Share on other sites More sharing options...
Datenshi Posted May 18, 2007 Author Share Posted May 18, 2007 This is the list which generates all the links on my video section: <?php session_start(); // Alltid överst på sidan // Kolla om inloggad = sessionen satt if (!isset($_SESSION['sess_user'])){ header("Location: ../index.php"); exit; } ?> <html> <head> <style type="text/css"> <!-- A {font-family:Georgia, "Times New Roman", Times, serif;font-size: 15px; } A:link {color:White;} A:visited {color: Gray;} A:hover {text-decoration: none; color: #00CCFF; font-weight:bold;} A:active {color: #00CCFF;text-decoration: none} } --> </style></head> <br><br><br> <div align="center"> <?php //Inkludera filen som connectar till databasen include "conn.php"; $query = mysql_query("SELECT * FROM videos ORDER BY id"); if (mysql_num_rows($query) <= 0) { echo "Tomt"; } else { while($row = mysql_fetch_array($query)) { echo '<a href="film.php?id=',$row['id'],'&fixit=.avi">',$row['name'],'</a><br>'; } } ?> </div> This is film.php, opens inside an iframe when i click a link: <?php session_start(); // Alltid överst på sidan // Kolla om inloggad = sessionen satt if (!isset($_SESSION['sess_user'])){ header("Location: ../index.php"); exit; } ?> <html> <head> <style type="text/css"> <!-- #Content { margin-left: 2px; margin-right: 40px; margin-bottom: 0px; margin-top: 40px; } --> </style></head> <div id="Content"> <object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="748" height="430"> <param name="custommode" value="Stage6" /> <param name="previewImage" value="luffybox3.jpg" /> <param name="autoPlay" value="false" /> <param name="src" value="<?php echo $result['path']; ?>" /> <embed type="video/divx" src="<?php echo $result['path']; ?>" width="748" height="430" autoPlay="false" custommode="Stage6" previewImage="luffybox3.jpg" pluginspage="http://go.divx.com/plugin/download/"> </embed> </object> </div> </html> Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-256027 Share on other sites More sharing options...
phast1 Posted May 18, 2007 Share Posted May 18, 2007 It looks like your film.php has no code for retrieving a record from the database based on the id that is being passed to it.. Doing something like this should work: <?php session_start(); // Alltid överst på sidan // Kolla om inloggad = sessionen satt if (!isset($_SESSION['sess_user'])){ header("Location: ../index.php"); exit; } //Inkludera filen som connectar till databasen include "conn.php"; $query = mysql_query("SELECT path FROM videos WHERE id='" . $_GET['id'] . "'"); if (mysql_num_rows($query) <= 0) { echo "Tomt"; } else { $result = mysql_fetch_assoc($query); } ?> <html> <head> <style type="text/css"> <!-- #Content { margin-left: 2px; margin-right: 40px; margin-bottom: 0px; margin-top: 40px; } --> </style></head> <div id="Content"> <object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="748" height="430"> <param name="custommode" value="Stage6" /> <param name="previewImage" value="luffybox3.jpg" /> <param name="autoPlay" value="false" /> <param name="src" value="<?php echo $result['path']; ?>" /> <embed type="video/divx" src="<?php echo $result['path']; ?>" width="748" height="430" autoPlay="false" custommode="Stage6" previewImage="luffybox3.jpg" pluginspage="http://go.divx.com/plugin/download/"> </embed> </object> </div> </html> Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-256115 Share on other sites More sharing options...
neel_basu Posted May 18, 2007 Share Posted May 18, 2007 one thing I Must say here why do some guys posts a lots of codes ?? here you have a problem on php just post that much php code that relates with your problem. dont post a single line extra codes. Just comment out //My CSS here //My Javascript here //My HTML here all the CSS and HTML, Javascript codes Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-256118 Share on other sites More sharing options...
Datenshi Posted May 18, 2007 Author Share Posted May 18, 2007 Cool phast1! it works now...or atleast i get something within the embed src tag..looks like this now: <embed type="video/divx" src="www.mysite.com%5Cessential%5C%5BDB%5D_Bleach_125_%5B76D5638F%5D.avi" autoplay="false" custommode="Stage6" previewimage="luffybox3.jpg" pluginspage="http://go.divx.com/plugin/download/" height="430" width="748"> Any idea why mysql returns % when its suppose to be / and [ ]. thanks huh weird, just noticed the line <param name="src" value="www.mysite.com\essential\[DB]_Bleach_125_[76D5638F].avi"> gets the right line delivered. Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-256340 Share on other sites More sharing options...
phast1 Posted May 18, 2007 Share Posted May 18, 2007 Excellent, glad to hear that its working But that's definitely strange how it would output two different things when the code is identical and uses the same value from the database.. It looks like the one with the % signs is URL encoded, so you could try this: <embed type="video/divx" src="<?php echo url_decode($result['path']); ?>" width="748" height="430" autoPlay="false" custommode="Stage6" previewImage="luffybox3.jpg" pluginspage="http://go.divx.com/plugin/download/"> If that doesn't work, then it might be encoded as HTML entities and you could try this: <embed type="video/divx" src="<?php echo html_entity_decode($result['path']); ?>" width="748" height="430" autoPlay="false" custommode="Stage6" previewImage="luffybox3.jpg" pluginspage="http://go.divx.com/plugin/download/"> Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-256455 Share on other sites More sharing options...
Datenshi Posted May 19, 2007 Author Share Posted May 19, 2007 Hm they didnt work. But even when i put a file which didnt have any spaces or special characters in the path, Divx Web Player gave me "Video file could not be downloaded" and crashes my browser..Im thinking of putting this project on hold since Divx Web Player is so damn buggy atm :'( Thx a bunch for the help Phast1..Divx team need people like you. Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-257232 Share on other sites More sharing options...
grizz Posted May 20, 2007 Share Posted May 20, 2007 What? The DivX Web Player crashes... ?!! mmmh, that should be fix pretty soon... php code has nothing to do with the DivX Player code, but thanks to phast1 sharing his knowledge. if you have some weird characters in you <object />, <embed /> then you don't follow properly the SDK instruction given to the webmasters. a solution for the [ ] would be to parse your sql result replacing the [ ] with the % % also a good practice to see if it is a divx web player issue or a php issue is first to do a html test : <object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="748" height="430"> <param name="custommode" value="Stage6" /> <param name="previewImage" value="luffybox3.jpg" /> <param name="autoPlay" value="false" /> <param name="src" value="the_url_you_want" /> <embed type="video/divx" src="the_url_you_want" width="748" height="430" autoPlay="false" custommode="Stage6" previewImage="luffybox3.jpg" pluginspage="http://go.divx.com/plugin/download/"> </embed> </object> also make sure "luffybox3.jpg" is valid. grizz Quote Link to comment https://forums.phpfreaks.com/topic/51600-divx-web-playerphpmysql-problem/#findComment-257353 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.