November 29, 2008

AJAX Video Player

Before you read further, this post is about a totally random theoretical/hypothetical idea. So do not question me on how it works or for proof of existence. I have no idea if such an idea or product is available.

Coming to the actual post now...

Well we all know that using AJAX we can refresh just a part of the webpage. So I was wondering what if we do the following:

1) Put a box of lets say 200 x 200 pixels on a webpage (the size of the box can be anything). And yeah under a div tag with an id lets say "player".

2) We create a bunch of images maybe 1000 and put them in a folder. Also we number them from 1 to 1000. Example: 1.jpg, 3.jpg, 674.jpg, etc.
At this point we also assume that the bunch of images are actually 1000 frames of a video and are named such that 1.jpg corresponds to frame 1 and so on.

3) Now we use JavaScript on the webpage so as to refresh the "player" part of the page asynchrounously so as to display the images sequentially.

4) And now we make another assumption. (If you are wondering why so many assumptions, its cause this idea is hypothetical). Lets assume that we can refresh the page 50 times in a second and also display an image completely with each refresh.

Then wont we be able to make a video player for browser using just JavaScript. And get rid of Flash Video Player and other players that come as plugins to the browser.

Note: Dont ask me to why I came out with this weird idea. I just thought about it.


  1. lol at 6 in the morning? :P

    true, it would be great to not need any plugins for video since JS is naturally supported.

    BUT internet connections are superfast now, and mpeg4 compression is brilliant.

    so you need another tool to fit into your idea. provided your internet is as fast as you've mentioned, you get a web service on the server side to send you a frame at a time as a jpg or whatever. I'm sure this should already exist. the idea wouldnt work if everyone had to convert all their video to images, so u need a go-between like this.

    go do some research n try it out ;)

  2. hmm... Converting video into frames shouldnt be that hard. Cause using software like VirtualDub we can already do that. Probably a script needs to be written to automate and do the naming of images and putting them in a folder.

    regarding a web service on the server side:
    I was thinking of sending all the images to the client side at once and putting them on the AJAX engine temporarily. Then the 50 refresh per second would be done within the client side computer itself.
    The time taken to create the AJAX engine with all the images is something like buffering in other players.

    Btw you got any experience in creating a web browser. I was thinking of trying it out during Dec. I googled on it and it seems alright.


    That link suggests the same idea in a very technical and detailed manner.

  4. yea something like that. there are tons of things like virtualdub. that's not what you need. you need something that works as a webservice. something that can be called with a PHP or JS functions etc.

  5. Maybe use Python. Cause that one seems to be suitable for web based and desktop based applications.

    Use Python to do the scripting for automating the image creation and stuff. Then use Python on the web with PHP i guess.

    At the moment I dont know much about Python but from what I've seen Python can be used with C client libraries. And read that you can use Python to develop web stuff as well.

  6. doesnt really matter which language you use.

    you're going to need a decoding service either way. to decode the video.