Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Greenhorn
Posts: 9
  • 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.
 
Ranch Hand
Posts: 294
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic