Jump to content

Divx Web Player+php+mysql problem


Datenshi

Recommended Posts

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?

 

 

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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..

 

Link to comment
Share on other sites

 

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>

 

 

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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/">

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.