Hi,

I need help in my code. I have a HTML page with this code:

<html>
<head>
<title>Prueba video</title>
</head>
<body>
<object id="MediaPlayer" type="application/x-oleobject" standby="Instalando Windows Media Player ..."
width="400" height="400" align="absMiddle" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="filename" value="GetVideo" />
<param name="autostart" value="true" />
<param name="showcontrols" value="true" />
<param name="showstatusbar" value="true" />

<embed type="application/x-mplayer2" src="GetVideo" name="MediaPlayer" width="400" height="400"
showcontrols="1" showstatusbar="1" autostart="1"></embed>
</object>

<object id="MediaPlayer" type="application/x-oleobject" standby="Instalando Windows Media Player ..."
width="400" height="400" align="absMiddle" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="filename" value="http://www.clublatino.es/prueba.avi"></param>
<param name="autostart" value="true" />
<param name="showcontrols" value="true" />
<param name="showstatusbar" value="true" />

<embed type="application/x-mplayer2" src="http://www.clublatino.es/prueba.avi" name="MediaPlayer" width="400" height="400"
showcontrols="1" showstatusbar="1" autostart="1"></embed>
</object>
</body>
</html>

And my servlet code is:

...
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletContext sc = getServletContext();

String a = sc.getRealPath("/");

try {
File fdesc = new File(a + "videos/prueba.avi");
Long longitud = new Long(fdesc.length());

response.reset();
response.setContentType("video/avi");
response.setContentLength(longitud.intValue());
response.setBufferSize(10240);

BufferedInputStream bis = new BufferedInputStream(new FileInputStream(fdesc), 10240);

ServletOutputStream os = response.getOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(os, 10240);

int read = 0;
byte[] bytes = new byte[10240];

while((read = bis.read(bytes)) != -1) {
bos.write(bytes, 0, read);
}

bos.close();
bis.close();
}
catch(Exception ex) {
sc.log(ex.toString());
}
}
...

The idea is loads a video file by stream, but the HTML page wait to load the entire file. What's wrong? I see a lot of examples, but anyone works.

Sorry for my english...