Steam
May 1st, 2006, 08:21 PM
Hello, Everybody
In my application I need to demonstrate some visual information. I keep video (.AVI) in database and have link on my JSP to show it. I use base Spring Controller. On request, It retrieves video from database and return it as output stream to JSP.
InputStream is = dataManager.getVideoAsStream( "2" );
if( is != null ) {
try {
response.setContentType( "video/x-msvideo" );
FileCopyUtils.copy( is, response.getOutputStream() );
}
catch( IOException e ) {
e.printStackTrace();
}
}
It works fine... almost… I have some strange behavior for .AVI video. It is going well if I get “Save Target As…” and play my downloaded file after that. But if I click on my link and trying to watch the video without saving file on disk, it plays sound only. Windows Media Player starts and plays my file without picture. There is no problem with codec, as I told…, it is possible to play this file correctly after downloading, but impossible directly as stream. May be I need to set some additional information in the header or something else…? Anybody had same problem?
Thank you.
In my application I need to demonstrate some visual information. I keep video (.AVI) in database and have link on my JSP to show it. I use base Spring Controller. On request, It retrieves video from database and return it as output stream to JSP.
InputStream is = dataManager.getVideoAsStream( "2" );
if( is != null ) {
try {
response.setContentType( "video/x-msvideo" );
FileCopyUtils.copy( is, response.getOutputStream() );
}
catch( IOException e ) {
e.printStackTrace();
}
}
It works fine... almost… I have some strange behavior for .AVI video. It is going well if I get “Save Target As…” and play my downloaded file after that. But if I click on my link and trying to watch the video without saving file on disk, it plays sound only. Windows Media Player starts and plays my file without picture. There is no problem with codec, as I told…, it is possible to play this file correctly after downloading, but impossible directly as stream. May be I need to set some additional information in the header or something else…? Anybody had same problem?
Thank you.