Results 1 to 1 of 1
- 05-19-2010, 11:24 AM #1
Member
- Join Date
- May 2010
- Posts
- 1
- Rep Power
- 0
Stream with servlet in windows media
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...
Similar Threads
-
how to use javax.media.jai.Interpolation
By MINGxDOG in forum Java 2DReplies: 0Last Post: 11-16-2009, 08:01 PM -
Media Center
By udalcse in forum Jobs OfferedReplies: 0Last Post: 10-27-2009, 01:35 PM -
Java Media Libraries
By SilentCodingOne in forum Advanced JavaReplies: 2Last Post: 07-04-2009, 05:21 AM -
Media Keys
By tikigod in forum New To JavaReplies: 0Last Post: 01-28-2009, 11:30 PM -
Media Metadata
By soulspirit in forum Advanced JavaReplies: 0Last Post: 11-26-2007, 11:01 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks