[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

pull up a video file from database

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 ...
0
Kaiwap
Asked:
Kaiwap
1 Solution
 
drakkarnoirCommented:
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:

CREATE TABLE videos (
id INT(5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
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.

<?php

if(!@mysql_connect('localhost','username','password'))
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>";
?>

-drakkar
0
 
Marcus BointonCommented:
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.
0
 
KaiwapAuthor Commented:
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
0
 
KaiwapAuthor Commented:
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"
            SRC="2fast2furious.mov"
            BGCOLOR="#ffffff" WIDTH=322
            HEIGHT=258 PLUGINSPAGE="http://www.apple.com/quicktime/download/"
            AUTOPLAY="TRUE" VOLUME="100" CACHE="TRUE">
      </embed>
</object>

Thanx for all your help ..  
0
 
moduloCommented:
PAQed with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now