This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating MJPEG-stream/video with servlet, is this even possible?

 
Nems Vedek
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I've created a servlet that fetches single images outside the servlet container/web server based on the parameters I give it and it works like this



The thing I was wondering could it be possible to create a somekind of a continuous stream by modifying the MIME content type and outputting all the images in the ...



... directory?

If not, any ideas how to create a stream/video from n+1 jpeg-images?

Thanks.
 
dema rogatkin
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's quite possible and will work. What kind of clients do you expect? If just a regular browser, then mozila based browsers will be the best. I use a similar technology for a chat program:
http://7bee.j2ee.us/chathouse/readme.htm
For content type look here: http://www.ltsw.se/knbase/internet/multipart.htp
 
Nems Vedek
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by dema rogatkin:
It's quite possible and will work. What kind of clients do you expect? If just a regular browser, then mozila based browsers will be the best. I use a similar technology for a chat program:
http://7bee.j2ee.us/chathouse/readme.htm



Thanks for the reply. Yes, I'm using browser as a client. Checked out your URL but every link gives me 404 on that page (?)
[ January 23, 2006: Message edited by: Nems Vedek ]
 
dema rogatkin
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry it was awhile, so some links may not work anymore. Generally do search on multipart/x-mixed-replace content type. It allows <b>server push</b> model, so for mozila browsers you can just continuously send jpegs and one will be replaced by another.
 
Nems Vedek
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by dema rogatkin:
It allows <b>server push</b> model, so for mozila browsers you can just continuously send jpegs and one will be replaced by another.


Yeah, been reading about the "server push"-technology and it seems it is just the thing I need.

But then I found out a page that said "IE doesn't support server push and NN6 has severe bugs in this area."

Aarggh. Sadly IE is still the most popular browser and I really would like to have an feature that worked with IE also.
 
dema rogatkin
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually IE supports it nicely. However it won't work for you since new pages just appended.
 
Nems Vedek
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by dema rogatkin:
Actually IE supports it nicely. However it won't work for you since new pages just appended.


Hmm, do you know is there a way to send n+1 images without appending new pages?

The servlet I wrote works just fine. Although for some reason I must hit refresh/F5 with firefox in order to get it started. With Opera it works just fine. Any idea what's wrong?

Here's some code:

 
dema rogatkin
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you get implementation of MultipartResponse? Many of them are floating around. I do not need to refresh first page for FF. Regarding IE, check HTTP spec, I remember there were some refresh headers, so maybe you can enforce IE to start from begining every part adding such headers in a part headers.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic