pull up a video file from database

Posted on 2004-08-12
Medium Priority
Last Modified: 2006-11-17
HI to all..

        I have a question here and hope some one could help me out with this.  I am trying to bring out a video file directly from the database using Mysql.  And I want it to be shown on the display page with options such as play, stop, and a small scroll bar.  What should i do about this?  It is like a previewing page of the video file.  And then I would like to add a link below to let ppl download the file.  Could anyone help me??

Thanx Thanx so much ...
Question by:Kaiwap
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 11785330
First off, storing images (videos are just a bunch of images) in ANY database (such as MySQL) is a very very bad idea but you could still do it.

The SQL for the structure of the DB should be:

bin_data LONGBLOB,
filename CHAR(50),
filesize CHAR(50)

As far as the play, stop, and scroll bar...I think you are better off posting it in the Java section of this site, and then using PHP's Java functions to implement the code.

Although, I suppose it is somewhat possible to do this via POST or GET methods...but that involves refreshing the page and then you have to code a complicated pause feature and well...I'd use Java.

Alternatively, if you STILL want to do the whole pause/play deal, look into the Windows Media Player Web Services or/and RealOne.

For the link, you can do:
Note: I want to write this using the MySQLi extension for PHP5, but I'm not sure if you do have PHP5 or the MySQLi extension...so here's the PHP4 take on it.


echo "Error: " . mysql_error() ."";
if(!@mysql_select_db('videos')) // assumes your database name is 'videos'
echo "Error: " . mysql_error() ."";

$video = mysql_fetch_array(mysql_query("SELECT id,filename from videos where id=$_GET[movieid]")); // so assuming that the URL has &movieid=9 or the number of the ID in the database for that movie

$path = basename($path, "".$_SERVER['PHP_SELF']") . $video['filename'];

echo "<a href='$path'>Download ". $video['filename'] ." now!</a>";

LVL 25

Expert Comment

by:Marcus Bointon
ID: 11787121
Some databases have very good video support, such as Frontbase and Oracle. Most video formats are totally passive (AVI, Real and WM, all of which are essentially play-only, with only laughable data support), offering very little in the way of depth. QuickTime is the exception. With a suitable database it's possible to submit a query that does the equivalent of "find me a point in any of these movies where someone says "hello" in Japanese or Spanish", and have it deliver you the movie cued up (streamed directly from the database) at the appropriate point. Just because MySQL doesn't cut it doesn't mean it's always a bad idea.
Because QuickTime supports reference movies, it's possible to store very small movies (say 20k) in blob fields that themselves contain references to larger movies stored externally (like te "click to play" frames on Apple's trailers site), or even meta-movies that do their own XML queries to find their movie data dynamically. This would work well in MySQL.
Link movies are a great way of sticking 20 movies on 1 page without being killed by the bandwidth requirements of loading them all at once - just click one and it will play in place, without a page refresh.

For controlling movies after loading, all the major formats' plugins have javascript-accessible functions to play/stop rewind, jump to point etc. They all also have their own built in controllers.

Author Comment

ID: 11803832
HELLO , to the administratives.    
        Can you help me merge the two topics together as I accidently posted it twice.  And the points i wanted to post is still 250, can you refund that for me too??  thx alot

Author Comment

ID: 11850608
I've had a easy one here:

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="480" height="320" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
<param name="SRC" value="2fast2furious.mov">
<param name="AUTOPLAY" value="true">
<param name="VOLUME" value="100">
<param name="CACHE" value="true">
<param name="TYPE" value="video/quicktime">
<param name="PLUGINSPAGE" value="http://www.apple.com/quicktime/download/">
      <embed TYPE="video/quicktime"
            BGCOLOR="#ffffff" WIDTH=322
            HEIGHT=258 PLUGINSPAGE="http://www.apple.com/quicktime/download/"
            AUTOPLAY="TRUE" VOLUME="100" CACHE="TRUE">

Thanx for all your help ..  

Accepted Solution

modulo earned 0 total points
ID: 12865117
PAQed with points refunded (250)

Community Support Moderator

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question