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
Solved

pull up a video file from database

Posted on 2004-08-12
6
335 Views
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 ...
0
Comment
Question by:Kaiwap
6 Comments
 

Expert Comment

by:drakkarnoir
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:

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

Author Comment

by:Kaiwap
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
0
 

Author Comment

by:Kaiwap
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"
            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
 

Accepted Solution

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

modulo
Community Support Moderator
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

790 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