Hello,

I once used this page :

http://rainbow.arch.scriptmania.com/scripts/music/video.html

This is not Struts-related but this is not hard to adapt it. I even used it
in response to an AJAX call.

HTH,

Pierre


2007/9/30, Muhammad Momin Rashid <[EMAIL PROTECTED]>:
>
> Hello Everyone,
>
> Can someone guide me on how to stream video using my struts 2 application.
>
> I have tried using the input stream method described in different
> thread.  while the method is working fine for images, it isn't working
> for video (flv) file.
>
> I also tried writing the flv file to output stream of the response, but
> it isn't working either.
>
> try
> {
>         HttpServletResponse response = ServletActionContext.getResponse();
>
>         OutputStream outputStream = response.getOutputStream();
>         File file = new File(filename);
>         FileInputStream fileInputStream = new FileInputStream(file);
>         byte[] buffer = new byte[1024 * 64];
>         int bytesRead;
>
>         response.setContentType("video/x-flv");
>         response.addHeader("Content-Disposition", "attachment; filename="
> +
> filename);
>         response.setContentLength((int) file.length());
>         response.addHeader("Cache-Control", "max-age=25");
>
>         while ((bytesRead = fileInputStream.read(buffer)) != -1)
>         {
>                 outputStream.write(buffer, 0, bytesRead);
>         }
>         fileInputStream.close();
>
> }
> catch (Exception e)
> {
> }
> return null;
>
>
> Regards,
> Muhammad Momin Rashid.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
"Deux choses ne se peuvent cacher : l'ivresse et l'amour."
(Antiphane)

Reply via email to