views:

82

answers:

2

I have <video src="someServlet"> where I write in servletOutputStream bytes from some video file, but it does not work. When I write <video src="/somedirectory/somefile.ogg">, it works fine. Can anyone help?

A: 

I'm assuming your file isn't working when you try to output the data dynamically but it works when you write it to a file and then link to it, right?

Some things to check:

  • are you passing the right parameters to the servlet and, if you use session/cookie data, are they passed correctly?
  • are you writing in the right format (remember, <video> only supports a handful of types)?
  • are you flushing the stream AND are you not prepending or appending spaces? (check the servlet carefully for extra spaces or newlines)

My money is on the last one, but try posting some code if you want more specific input.

Blindy
+1  A: 

Check the servlet is setting the MIME type correctly. For .ogg use video/ogg.

response.setContentType("video/ogg");

Use "$ wget -S <url>" to compare the http headers from the two urls: someServlet, /somedirectory/somefile.ogg. This may help you isolate the difference in the two responses.

Janek Bogucki