SitePoint Sponsor

User Tag List

Results 1 to 16 of 16

Thread: Loading Movie

  1. #1
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Loading Movie

    Hi guys, can anyone help me how to load a movie(mpeg, avi) or flash using ajax and php.

  2. #2
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XMLHttpRequest doesn't handle multipart/form-data, the MIME type used for file uploads. You'll need to use a hidden IFRAME.

  3. #3
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Knowing that I'm going to create a hidden iFrame, how can I load a movie just like the youtube?

  4. #4
    SitePoint Evangelist
    Join Date
    Jun 2007
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by World Wide Weird View Post
    XMLHttpRequest doesn't handle multipart/form-data, the MIME type used for file uploads. You'll need to use a hidden IFRAME.
    oh I was also in search of this.

    But how this orkut and other photo upload works in Ajax ?

  5. #5
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use AJAX for the progress meter, but the actual file upload has to be done with an IFRAME. The upload script that runs in the IFRAME will presumably respond with some JavaScript that informs the parent window when the upload completes.

    I don't use Orkut or YouTube, so I don't have specific knowledge of their techniques. The folks in the JavaScript forum can probably give a more detailed answer, or maybe felgall or pwm57 will peek in here later.

  6. #6
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you mean (down)load or upload?

    If (down)load, what do you mean "load"? Something has to play it, and you cannot do that in pure JavaScript.

    As for upload, you need to use a regular file upload form and send it to a hidden frame. JavaScript cannot access the user's file system. To show the progress of an upload using PHP, you'll have to look into that. PHP doesn't do it out of the box (the last time I checked), so you will need some extension.

    However, you can also do uploads with Flash. You can show the progress bar purely client-side because Flash provides upload progress information.

    ...or Java.

  7. #7
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have no problem in uploading the videos in my database. The only problem is, how can I play the movie being uploaded on the database using ajax.

  8. #8
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I mean doing video streaming online using ajax and php

  9. #9
    SitePoint Evangelist
    Join Date
    Jun 2007
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sirGE View Post
    I mean doing video streaming online using ajax and php
    oh you can use Ajax framework Mootool for it.

    For streaming video using Ajax.

    You mean video in popup or others ?


  10. #10
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is my first time to use that framework. Do you have a very good site for tutorial?

  11. #11
    SitePoint Evangelist
    Join Date
    Jun 2007
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just google it.

    I have seen some in mootol wiki as well as in this site :

    http://www.mootorial.com/

    But its easy to use.

  12. #12
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see. The video is stored in a database, and you want to stream it from there. Hmmm. A media player needs a URL to connect to, which the database doesn't supply. You could presumably write a PHP script to read it from the database and use the script's URL as the source for the player. But guess what? Database engines aren't designed for streaming media. There's no SQL query that will dole out the contents of a field at a measured pace. You'll have to transfer the file to the filesystem before streaming it. Since it will presumably be viewed by many people, you may as well store it on the filesystem in the first place. Otherwise your database server is going to get really slow.

  13. #13
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    World Wide Weird, if that would the case, how am I going to secretly download the file from the filesystem? I mean, when the user click on the [Play this Video] link on the page, I don't like to show the download dialog box on the screen.

  14. #14
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you download a file, you're going to see the download dialog regardless of where the file is stored on the server.

  15. #15
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then, how am I be able to transfer the file on the filesystem?

  16. #16
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't understand the question. Do you want to retrieve the file from the database and store it on the filesystem as a regular file? Use a SELECT statement to get it into a variable, then use file_put_contents() to write it to a new file.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •